Re: [PATCH net v2] usbnet: fix error return code in usbnet_probe()

From
Johan Hovold <johan@kernel.org>
Date
2021-10-26 12:30:57
Also in
linux-usb, lkml
Reply to
Wang Hai, 2021-10-26
On Tue, Oct 26, 2021 at 08:40:15PM +0800, Wang Hai wrote:
Return error code if usb_maxpacket() returns 0 in usbnet_probe()

Fixes: 397430b50a36 ("usbnet: sanity check for maxpacket")
Reported-by: Hulk Robot <redacted>
Signed-off-by: Wang Hai <redacted>
This needs to go to stable as well as the offending patch is being
backported.

Cc: <redacted>
Reviewed-by: Johan Hovold <johan@kernel.org>
quoted hunk ↗ jump to hunk
---
v1->v2: change '-EINVAL' to '-ENODEV'
 drivers/net/usb/usbnet.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 80432ee0ce69..a33d7fb82a00 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1790,6 +1790,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1);
 	if (dev->maxpacket == 0) {
 		/* that is a broken device */
+		status = -ENODEV;
 		goto out4;
 	}
Johan
Thread (3 messages) 3 messages, 3 authors, last reply 2021-10-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help