[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025083031-lavender-rebel-ee20@gregkh>
Date: Sat, 30 Aug 2025 12:53:09 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Max Schulze <max.schulze@...ine.de>,
Krzysztof HaĆasa <khalasa@...p.pl>,
David Hollis <dhollis@...ehollis.com>,
Greg Kroah-Hartman <gregkh@...e.de>,
David Brownell <david-b@...bell.net>, linux-usb@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: usb: asix_devices: Check return value of
usbnet_get_endpoints
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@...il.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
Powered by blists - more mailing lists