dm9000: NULL dereferences on error in probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 1 Aug 2014 08:23:57 +0000 (11:23 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 2 Aug 2014 22:28:23 +0000 (15:28 -0700)
The dm9000_release_board() function is called with NULL ->data_req and
->addr_req pointers if dm9000_probe() fails.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/davicom/dm9000.c

index 13723c96d1a272896dffac2f95a1c0b18204674e..23084fb2090e3689bef788c99923045f5acc46ea 100644 (file)
@@ -817,10 +817,12 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
 
        /* release the resources */
 
-       release_resource(db->data_req);
+       if (db->data_req)
+               release_resource(db->data_req);
        kfree(db->data_req);
 
-       release_resource(db->addr_req);
+       if (db->addr_req)
+               release_resource(db->addr_req);
        kfree(db->addr_req);
 }