Skip to content

Commit 3ed58f9

Browse files
Andre Edichdavem330
authored andcommitted
smsc95xx: avoid memory leak in smsc95xx_bind
In a case where the ID_REV register read is failed, the memory for a private data structure has to be freed before returning error from the function smsc95xx_bind. Fixes: bbd9f9e ("smsc95xx: add wol support for more frame types") Signed-off-by: Andre Edich <[email protected]> Signed-off-by: Parthiban Veerasooran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c8b1e8 commit 3ed58f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/usb/smsc95xx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
12931293
/* detect device revision as different features may be available */
12941294
ret = smsc95xx_read_reg(dev, ID_REV, &val);
12951295
if (ret < 0)
1296-
return ret;
1296+
goto free_pdata;
1297+
12971298
val >>= 16;
12981299
pdata->chip_id = val;
12991300
pdata->mdix_ctrl = get_mdix_status(dev->net);

0 commit comments

Comments
 (0)