Skip to content

Commit 8956997

Browse files
YuuoniyUlrich Hecht
authored andcommitted
net: usb: asix_devices: Check return value of usbnet_get_endpoints
commit dc89548c6926d68dfdda11bebc1a5258bc41d887 upstream. The code did not check the return value of usbnet_get_endpoints. Add checks and return the error if it fails to transfer the error. Found via static anlaysis and this is similar to commit 07161b2416f7 ("sr9800: Add check for usbnet_get_endpoints"). Fixes: 933a27d ("USB: asix - Add AX88178 support and many other changes") Fixes: 2e55cc7 ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters") Cc: stable@vger.kernel.org Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Link: https://patch.msgid.link/20251026164318.57624-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 6ebb6c5 commit 8956997

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/net/usb/asix_devices.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
242242
int i;
243243
unsigned long gpio_bits = dev->driver_info->data;
244244

245-
usbnet_get_endpoints(dev,intf);
245+
ret = usbnet_get_endpoints(dev, intf);
246+
if (ret)
247+
goto out;
246248

247249
/* Toggle the GPIOs in a manufacturer/model specific way */
248250
for (i = 2; i >= 0; i--) {
@@ -693,7 +695,9 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
693695
u32 phyid;
694696
struct asix_common_private *priv;
695697

696-
usbnet_get_endpoints(dev, intf);
698+
ret = usbnet_get_endpoints(dev, intf);
699+
if (ret)
700+
return ret;
697701

698702
/* Maybe the boot loader passed the MAC address via device tree */
699703
if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
@@ -1075,7 +1079,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
10751079
int ret;
10761080
u8 buf[ETH_ALEN] = {0};
10771081

1078-
usbnet_get_endpoints(dev,intf);
1082+
ret = usbnet_get_endpoints(dev, intf);
1083+
if (ret)
1084+
return ret;
10791085

10801086
/* Get the MAC address */
10811087
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);

0 commit comments

Comments
 (0)