diff options
author | Andre Edich <andre.edich@microchip.com> | 2020-07-06 11:39:35 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-22 10:22:17 +0300 |
commit | 2970348a38646e562dfae371c5bae52614dba99a (patch) | |
tree | 933a1520d0527cb94ae9b57d6234e29d87c0c61f | |
parent | 9088f1ab90ddd09e57acd3c6a363f85a62a60fa8 (diff) | |
download | linux-2970348a38646e562dfae371c5bae52614dba99a.tar.xz |
smsc95xx: avoid memory leak in smsc95xx_bind
[ Upstream commit 3ed58f96a70b85ef646d5427258f677f1395b62f ]
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: bbd9f9ee69242 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 859dfb4a9a57..bc6bcea67bff 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1307,7 +1307,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); |