From: Greg KH <gregkh@linuxfoundation.org>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Max Schulze" <max.schulze@online.de>,
"Krzysztof Hałasa" <khalasa@piap.pl>,
"David Hollis" <dhollis@davehollis.com>,
"Greg Kroah-Hartman" <gregkh@suse.de>,
"David Brownell" <david-b@pacbell.net>,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: usb: asix_devices: Check return value of usbnet_get_endpoints
Date: Sat, 30 Aug 2025 12:53:09 +0200 [thread overview]
Message-ID: <2025083031-lavender-rebel-ee20@gregkh> (raw)
In-Reply-To: <20250830103743.2118777-1-linmq006@gmail.com>
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
prev parent reply other threads:[~2025-08-30 10:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-30 10:37 [PATCH] net: usb: asix_devices: Check return value of usbnet_get_endpoints Miaoqian Lin
2025-08-30 10:53 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2025083031-lavender-rebel-ee20@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=david-b@pacbell.net \
--cc=dhollis@davehollis.com \
--cc=edumazet@google.com \
--cc=gregkh@suse.de \
--cc=khalasa@piap.pl \
--cc=kuba@kernel.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=max.schulze@online.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox