All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb
@ 2021-06-11 20:02 syzbot
  2021-06-12  6:59 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2021-06-11 20:02 UTC (permalink / raw)
  To: gregkh, johan, linux-kernel, linux-usb, mathias.nyman, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    614124be Linux 5.13-rc5
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12188667d00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=547a5e42ca601229
dashboard link: https://syzkaller.appspot.com/bug?extid=5f29dc6a889fc42bd896
compiler:       Debian clang version 11.0.1-2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1687ec3fd00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=172f44ffd00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5f29dc6a889fc42bd896@syzkaller.appspotmail.com

usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
usb 1-1: config 0 descriptor??
------------[ cut here ]------------
usb 1-1: BOGUS urb xfer, pipe 1 != type 3
WARNING: CPU: 1 PID: 20 at drivers/usb/core/urb.c:494 usb_submit_urb+0xacd/0x1550 drivers/usb/core/urb.c:493
Modules linked in:
CPU: 1 PID: 20 Comm: kworker/1:0 Not tainted 5.13.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
RIP: 0010:usb_submit_urb+0xacd/0x1550 drivers/usb/core/urb.c:493
Code: d8 48 c1 e8 03 42 8a 04 28 84 c0 0f 85 bd 07 00 00 44 8b 03 48 c7 c7 00 8a e1 8a 4c 89 f6 4c 89 fa 89 e9 31 c0 e8 83 d6 8f fb <0f> 0b 4c 8b 74 24 30 45 89 f7 4c 89 ff 48 c7 c6 b0 e1 8d 8d e8 8a
RSP: 0018:ffffc90000da6880 EFLAGS: 00010246
RAX: 0c18ab37a32f8700 RBX: ffffffff8ae18828 RCX: ffff888012c30000
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: 0000000000000001 R08: ffffffff81655632 R09: ffffed1017365f90
R10: ffffed1017365f90 R11: 0000000000000000 R12: ffff888022972100
R13: dffffc0000000000 R14: ffffffff8ae22a60 R15: ffff88801da57118
FS:  0000000000000000(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f156613e000 CR3: 0000000018033000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 usb_start_wait_urb+0x11a/0x550 drivers/usb/core/message.c:58
 vmk80xx_write_packet drivers/comedi/drivers/vmk80xx.c:213 [inline]
 vmk80xx_reset_device drivers/comedi/drivers/vmk80xx.c:226 [inline]
 vmk80xx_auto_attach+0xcc7/0x22d0 drivers/comedi/drivers/vmk80xx.c:817


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb
  2021-06-11 20:02 [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb syzbot
@ 2021-06-12  6:59 ` Greg KH
  2021-06-12 14:19   ` Alan Stern
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2021-06-12  6:59 UTC (permalink / raw)
  To: syzbot; +Cc: johan, linux-kernel, linux-usb, mathias.nyman, syzkaller-bugs

On Fri, Jun 11, 2021 at 01:02:23PM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    614124be Linux 5.13-rc5
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12188667d00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=547a5e42ca601229
> dashboard link: https://syzkaller.appspot.com/bug?extid=5f29dc6a889fc42bd896
> compiler:       Debian clang version 11.0.1-2
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1687ec3fd00000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=172f44ffd00000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+5f29dc6a889fc42bd896@syzkaller.appspotmail.com
> 
> usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> usb 1-1: config 0 descriptor??
> ------------[ cut here ]------------
> usb 1-1: BOGUS urb xfer, pipe 1 != type 3
> WARNING: CPU: 1 PID: 20 at drivers/usb/core/urb.c:494 usb_submit_urb+0xacd/0x1550 drivers/usb/core/urb.c:493

Looks correct to me, you did not create a valid USB device for the
system to use :)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb
  2021-06-12  6:59 ` Greg KH
@ 2021-06-12 14:19   ` Alan Stern
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Stern @ 2021-06-12 14:19 UTC (permalink / raw)
  To: Greg KH
  Cc: syzbot, johan, linux-kernel, linux-usb, mathias.nyman, syzkaller-bugs

On Sat, Jun 12, 2021 at 08:59:26AM +0200, Greg KH wrote:
> On Fri, Jun 11, 2021 at 01:02:23PM -0700, syzbot wrote:
> > Hello,
> > 
> > syzbot found the following issue on:
> > 
> > HEAD commit:    614124be Linux 5.13-rc5
> > git tree:       upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=12188667d00000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=547a5e42ca601229
> > dashboard link: https://syzkaller.appspot.com/bug?extid=5f29dc6a889fc42bd896
> > compiler:       Debian clang version 11.0.1-2
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1687ec3fd00000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=172f44ffd00000
> > 
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+5f29dc6a889fc42bd896@syzkaller.appspotmail.com
> > 
> > usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> > usb 1-1: config 0 descriptor??
> > ------------[ cut here ]------------
> > usb 1-1: BOGUS urb xfer, pipe 1 != type 3
> > WARNING: CPU: 1 PID: 20 at drivers/usb/core/urb.c:494 usb_submit_urb+0xacd/0x1550 drivers/usb/core/urb.c:493
> 
> Looks correct to me, you did not create a valid USB device for the
> system to use :)

The problem is that vmk80xx_write_packet submits an interrupt URB to 
the ep_tx endpoint, but vmk80xx_find_usb_endpoints will set ep_tx to the 
first OUT endpoint it finds that is either interrupt or bulk.  In this 
case it was bulk, so the driver submitted an interrupt URB to a bulk 
endpoint.

Alan Stern

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb
@ 2024-04-07 13:02 Nikita Zhandarovich
  0 siblings, 0 replies; 7+ messages in thread
From: Nikita Zhandarovich @ 2024-04-07 13:02 UTC (permalink / raw)
  To: syzbot+5f29dc6a889fc42bd896
  Cc: Nikita Zhandarovich, syzkaller-bugs, linux-kernel

Refactor endpoint checks to ensure there is no ambivalence
about endpoint types.

Try a specific branch to mitigate unrelated issues with boot/build.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe46a7dd189e
---
 drivers/comedi/drivers/vmk80xx.c | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
index 4536ed43f65b..476885403c61 100644
--- a/drivers/comedi/drivers/vmk80xx.c
+++ b/drivers/comedi/drivers/vmk80xx.c
@@ -641,33 +641,22 @@ static int vmk80xx_find_usb_endpoints(struct comedi_device *dev)
 	struct vmk80xx_private *devpriv = dev->private;
 	struct usb_interface *intf = comedi_to_usb_interface(dev);
 	struct usb_host_interface *iface_desc = intf->cur_altsetting;
-	struct usb_endpoint_descriptor *ep_desc;
-	int i;
+	struct usb_endpoint_descriptor *ep_rx_desc, *ep_tx_desc;
+	int i, ret;
 
-	if (iface_desc->desc.bNumEndpoints != 2)
-		return -ENODEV;
-
-	for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-		ep_desc = &iface_desc->endpoint[i].desc;
-
-		if (usb_endpoint_is_int_in(ep_desc) ||
-		    usb_endpoint_is_bulk_in(ep_desc)) {
-			if (!devpriv->ep_rx)
-				devpriv->ep_rx = ep_desc;
-			continue;
-		}
-
-		if (usb_endpoint_is_int_out(ep_desc) ||
-		    usb_endpoint_is_bulk_out(ep_desc)) {
-			if (!devpriv->ep_tx)
-				devpriv->ep_tx = ep_desc;
-			continue;
-		}
-	}
+	if (devpriv->model == VMK8061_MODEL)
+		ret = usb_find_common_endpoints(iface_desc, &ep_rx_desc,
+						&ep_tx_desc, NULL, NULL);
+	else
+		ret = usb_find_common_endpoints(iface_desc, NULL, NULL,
+						&ep_rx_desc, &ep_tx_desc);
 
-	if (!devpriv->ep_rx || !devpriv->ep_tx)
+	if (ret)
 		return -ENODEV;
 
+	devpriv->ep_rx = ep_rx_desc;
+	devpriv->ep_tx = ep_tx_desc;
+
 	if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx))
 		return -EINVAL;
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb
@ 2024-04-05 13:34 Nikita Zhandarovich
  0 siblings, 0 replies; 7+ messages in thread
From: Nikita Zhandarovich @ 2024-04-05 13:34 UTC (permalink / raw)
  To: syzbot+5f29dc6a889fc42bd896
  Cc: Nikita Zhandarovich, syzkaller-bugs, linux-kernel

Refactor endpoint checks to ensure there is no ambivalence
about endpoint types.

Try a specific branch to mitigate unrelated issues with boot/build.

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 4090fa373f0e763c43610853d2774b5979915959
---
 drivers/comedi/drivers/vmk80xx.c | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
index 4536ed43f65b..476885403c61 100644
--- a/drivers/comedi/drivers/vmk80xx.c
+++ b/drivers/comedi/drivers/vmk80xx.c
@@ -641,33 +641,22 @@ static int vmk80xx_find_usb_endpoints(struct comedi_device *dev)
 	struct vmk80xx_private *devpriv = dev->private;
 	struct usb_interface *intf = comedi_to_usb_interface(dev);
 	struct usb_host_interface *iface_desc = intf->cur_altsetting;
-	struct usb_endpoint_descriptor *ep_desc;
-	int i;
+	struct usb_endpoint_descriptor *ep_rx_desc, *ep_tx_desc;
+	int i, ret;
 
-	if (iface_desc->desc.bNumEndpoints != 2)
-		return -ENODEV;
-
-	for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-		ep_desc = &iface_desc->endpoint[i].desc;
-
-		if (usb_endpoint_is_int_in(ep_desc) ||
-		    usb_endpoint_is_bulk_in(ep_desc)) {
-			if (!devpriv->ep_rx)
-				devpriv->ep_rx = ep_desc;
-			continue;
-		}
-
-		if (usb_endpoint_is_int_out(ep_desc) ||
-		    usb_endpoint_is_bulk_out(ep_desc)) {
-			if (!devpriv->ep_tx)
-				devpriv->ep_tx = ep_desc;
-			continue;
-		}
-	}
+	if (devpriv->model == VMK8061_MODEL)
+		ret = usb_find_common_endpoints(iface_desc, &ep_rx_desc,
+						&ep_tx_desc, NULL, NULL);
+	else
+		ret = usb_find_common_endpoints(iface_desc, NULL, NULL,
+						&ep_rx_desc, &ep_tx_desc);
 
-	if (!devpriv->ep_rx || !devpriv->ep_tx)
+	if (ret)
 		return -ENODEV;
 
+	devpriv->ep_rx = ep_rx_desc;
+	devpriv->ep_tx = ep_tx_desc;
+
 	if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx))
 		return -EINVAL;
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb
  2024-04-05 13:30 Nikita Zhandarovich
@ 2024-04-05 13:30 ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2024-04-05 13:30 UTC (permalink / raw)
  To: n.zhandarovich; +Cc: linux-kernel, n.zhandarovich, syzkaller-bugs

> Refactor endpoint checks to ensure there is no ambivalence
> about endpoint types.
>
> Try a specific branch to mitigate unrelated issues with boot/build.
>
> #syz test git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 4090fa373f0e763c43610853>

"4090fa373f0e763c43610853>" does not look like a valid git branch or commit.

> ---
>  drivers/comedi/drivers/vmk80xx.c | 35 ++++++++++++-----------------------
>  1 file changed, 12 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
> index 4536ed43f65b..476885403c61 100644
> --- a/drivers/comedi/drivers/vmk80xx.c
> +++ b/drivers/comedi/drivers/vmk80xx.c
> @@ -641,33 +641,22 @@ static int vmk80xx_find_usb_endpoints(struct comedi_device *dev)
>  	struct vmk80xx_private *devpriv = dev->private;
>  	struct usb_interface *intf = comedi_to_usb_interface(dev);
>  	struct usb_host_interface *iface_desc = intf->cur_altsetting;
> -	struct usb_endpoint_descriptor *ep_desc;
> -	int i;
> +	struct usb_endpoint_descriptor *ep_rx_desc, *ep_tx_desc;
> +	int i, ret;
>  
> -	if (iface_desc->desc.bNumEndpoints != 2)
> -		return -ENODEV;
> -
> -	for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
> -		ep_desc = &iface_desc->endpoint[i].desc;
> -
> -		if (usb_endpoint_is_int_in(ep_desc) ||
> -		    usb_endpoint_is_bulk_in(ep_desc)) {
> -			if (!devpriv->ep_rx)
> -				devpriv->ep_rx = ep_desc;
> -			continue;
> -		}
> -
> -		if (usb_endpoint_is_int_out(ep_desc) ||
> -		    usb_endpoint_is_bulk_out(ep_desc)) {
> -			if (!devpriv->ep_tx)
> -				devpriv->ep_tx = ep_desc;
> -			continue;
> -		}
> -	}
> +	if (devpriv->model == VMK8061_MODEL)
> +		ret = usb_find_common_endpoints(iface_desc, &ep_rx_desc,
> +						&ep_tx_desc, NULL, NULL);
> +	else
> +		ret = usb_find_common_endpoints(iface_desc, NULL, NULL,
> +						&ep_rx_desc, &ep_tx_desc);
>  
> -	if (!devpriv->ep_rx || !devpriv->ep_tx)
> +	if (ret)
>  		return -ENODEV;
>  
> +	devpriv->ep_rx = ep_rx_desc;
> +	devpriv->ep_tx = ep_tx_desc;
> +
>  	if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx))
>  		return -EINVAL;
>  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb
@ 2024-04-05 13:30 Nikita Zhandarovich
  2024-04-05 13:30 ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: Nikita Zhandarovich @ 2024-04-05 13:30 UTC (permalink / raw)
  To: syzbot+5f29dc6a889fc42bd896
  Cc: Nikita Zhandarovich, syzkaller-bugs, linux-kernel

Refactor endpoint checks to ensure there is no ambivalence
about endpoint types.

Try a specific branch to mitigate unrelated issues with boot/build.

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 4090fa373f0e763c43610853>
---
 drivers/comedi/drivers/vmk80xx.c | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
index 4536ed43f65b..476885403c61 100644
--- a/drivers/comedi/drivers/vmk80xx.c
+++ b/drivers/comedi/drivers/vmk80xx.c
@@ -641,33 +641,22 @@ static int vmk80xx_find_usb_endpoints(struct comedi_device *dev)
 	struct vmk80xx_private *devpriv = dev->private;
 	struct usb_interface *intf = comedi_to_usb_interface(dev);
 	struct usb_host_interface *iface_desc = intf->cur_altsetting;
-	struct usb_endpoint_descriptor *ep_desc;
-	int i;
+	struct usb_endpoint_descriptor *ep_rx_desc, *ep_tx_desc;
+	int i, ret;
 
-	if (iface_desc->desc.bNumEndpoints != 2)
-		return -ENODEV;
-
-	for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-		ep_desc = &iface_desc->endpoint[i].desc;
-
-		if (usb_endpoint_is_int_in(ep_desc) ||
-		    usb_endpoint_is_bulk_in(ep_desc)) {
-			if (!devpriv->ep_rx)
-				devpriv->ep_rx = ep_desc;
-			continue;
-		}
-
-		if (usb_endpoint_is_int_out(ep_desc) ||
-		    usb_endpoint_is_bulk_out(ep_desc)) {
-			if (!devpriv->ep_tx)
-				devpriv->ep_tx = ep_desc;
-			continue;
-		}
-	}
+	if (devpriv->model == VMK8061_MODEL)
+		ret = usb_find_common_endpoints(iface_desc, &ep_rx_desc,
+						&ep_tx_desc, NULL, NULL);
+	else
+		ret = usb_find_common_endpoints(iface_desc, NULL, NULL,
+						&ep_rx_desc, &ep_tx_desc);
 
-	if (!devpriv->ep_rx || !devpriv->ep_tx)
+	if (ret)
 		return -ENODEV;
 
+	devpriv->ep_rx = ep_rx_desc;
+	devpriv->ep_tx = ep_tx_desc;
+
 	if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx))
 		return -EINVAL;
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-07 13:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 20:02 [syzbot] WARNING in vmk80xx_auto_attach/usb_submit_urb syzbot
2021-06-12  6:59 ` Greg KH
2021-06-12 14:19   ` Alan Stern
2024-04-05 13:30 Nikita Zhandarovich
2024-04-05 13:30 ` syzbot
2024-04-05 13:34 Nikita Zhandarovich
2024-04-07 13:02 Nikita Zhandarovich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.