Commit ae613d60 authored by Andre Edich's avatar Andre Edich Committed by Khalid Elmously

smsc95xx: avoid memory leak in smsc95xx_bind

BugLink: https://bugs.launchpad.net/bugs/1888690

[ Upstream commit 3ed58f96 ]

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: bbd9f9ee ("smsc95xx: add wol support for more frame types")
Signed-off-by: default avatarAndre Edich <andre.edich@microchip.com>
Signed-off-by: default avatarParthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 434aa2e9
...@@ -1142,7 +1142,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -1142,7 +1142,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
/* detect device revision as different features may be available */ /* detect device revision as different features may be available */
ret = smsc95xx_read_reg(dev, ID_REV, &val); ret = smsc95xx_read_reg(dev, ID_REV, &val);
if (ret < 0) if (ret < 0)
return ret; goto free_pdata;
val >>= 16; val >>= 16;
if ((val == ID_REV_CHIP_ID_9500A_) || (val == ID_REV_CHIP_ID_9530_) || if ((val == ID_REV_CHIP_ID_9500A_) || (val == ID_REV_CHIP_ID_9530_) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment