Skip to content

Commit

Permalink
smsc95xx: avoid memory leak in smsc95xx_bind
Browse files Browse the repository at this point in the history
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 <andre.edich@microchip.com>
Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andre Edich authored and davem330 committed Jul 6, 2020
1 parent 7c8b1e8 commit 3ed58f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/usb/smsc95xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
/* detect device revision as different features may be available */
ret = smsc95xx_read_reg(dev, ID_REV, &val);
if (ret < 0)
return ret;
goto free_pdata;

val >>= 16;
pdata->chip_id = val;
pdata->mdix_ctrl = get_mdix_status(dev->net);
Expand Down

0 comments on commit 3ed58f9

Please sign in to comment.