drivers/net/usb/asix_devices.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
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.
Fixes: 933a27d39e0e ("USB: asix - Add AX88178 support and many other changes")
Fixes: 2e55cc7210fe ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/net/usb/asix_devices.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 9b0318fb50b5..92a5d6956cb3 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -230,7 +230,9 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
int i;
unsigned long gpio_bits = dev->driver_info->data;
- usbnet_get_endpoints(dev,intf);
+ ret = usbnet_get_endpoints(dev, intf);
+ if (ret)
+ goto out;
/* Toggle the GPIOs in a manufacturer/model specific way */
for (i = 2; i >= 0; i--) {
@@ -832,7 +834,9 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
dev->driver_priv = priv;
- usbnet_get_endpoints(dev, intf);
+ ret = usbnet_get_endpoints(dev, intf);
+ if (ret)
+ return ret;
/* Maybe the boot loader passed the MAC address via device tree */
if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) {
@@ -1256,7 +1260,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
int ret;
u8 buf[ETH_ALEN] = {0};
- usbnet_get_endpoints(dev,intf);
+ ret = usbnet_get_endpoints(dev, intf);
+ if (ret)
+ return ret;
/* Get the MAC address */
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);
@@ -1609,4 +1615,3 @@ MODULE_AUTHOR("David Hollis");
MODULE_VERSION(DRIVER_VERSION);
MODULE_DESCRIPTION("ASIX AX8817X based USB 2.0 Ethernet Devices");
MODULE_LICENSE("GPL");
-
--
2.35.1
On Sat, Aug 30, 2025 at 06:37:41PM +0800, Miaoqian Lin wrote: > 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. > > Fixes: 933a27d39e0e ("USB: asix - Add AX88178 support and many other changes") > Fixes: 2e55cc7210fe ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters") > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> > --- > drivers/net/usb/asix_devices.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c > index 9b0318fb50b5..92a5d6956cb3 100644 > --- a/drivers/net/usb/asix_devices.c > +++ b/drivers/net/usb/asix_devices.c > @@ -230,7 +230,9 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) > int i; > unsigned long gpio_bits = dev->driver_info->data; > > - usbnet_get_endpoints(dev,intf); > + ret = usbnet_get_endpoints(dev, intf); > + if (ret) > + goto out; > > /* Toggle the GPIOs in a manufacturer/model specific way */ > for (i = 2; i >= 0; i--) { > @@ -832,7 +834,9 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) > > dev->driver_priv = priv; > > - usbnet_get_endpoints(dev, intf); > + ret = usbnet_get_endpoints(dev, intf); > + if (ret) > + return ret; > > /* Maybe the boot loader passed the MAC address via device tree */ > if (!eth_platform_get_mac_address(&dev->udev->dev, buf)) { > @@ -1256,7 +1260,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) > int ret; > u8 buf[ETH_ALEN] = {0}; > > - usbnet_get_endpoints(dev,intf); > + ret = usbnet_get_endpoints(dev, intf); > + if (ret) > + return ret; > > /* Get the MAC address */ > ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); > @@ -1609,4 +1615,3 @@ MODULE_AUTHOR("David Hollis"); > MODULE_VERSION(DRIVER_VERSION); > MODULE_DESCRIPTION("ASIX AX8817X based USB 2.0 Ethernet Devices"); > MODULE_LICENSE("GPL"); > - Why did you remove this blank line? Also, how was this tested? And you forgot to add a cc: stable? thanks, greg k-h
© 2016 - 2025 Red Hat, Inc.