Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5c2a944 authored by Andre Edich's avatar Andre Edich Committed by Greg Kroah-Hartman
Browse files

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: 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>
parent 10929819
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);