public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Chenyuan Yang <chenyuan0y@gmail.com>
Cc: azeemshaikh38@gmail.com, ivan.orlov0322@gmail.com,
	benjamin.tissoires@redhat.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
	Zijie Zhao <zzjas98@gmail.com>
Subject: Re: [Linux Kernel Bug][usb/f_printer] WARNING in usb_ep_queue
Date: Fri, 2 Feb 2024 13:08:25 -0800	[thread overview]
Message-ID: <2024020256-contented-concave-92d0@gregkh> (raw)
In-Reply-To: <CALGdzurBnMztPW1Q8mujfYaopVQ8MkSUXUvnAqJcLGu5ROSU4Q@mail.gmail.com>

On Fri, Feb 02, 2024 at 12:59:31PM -0600, Chenyuan Yang wrote:
> Dear Linux Developers for F_printer,
> 
> We encountered "WARNING in usb_ep_queue" when testing the f_printer driver with
> Syzkaller and our generated specifications.
> 
> I attached the report and C/syz reproducers for this crash.
> 
> ```
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 10395 at drivers/usb/gadget/udc/core.c:295
> usb_ep_queue+0xa0/0x300 linux/drivers/usb/gadget/udc/core.c:295
> Modules linked in:
> CPU: 1 PID: 10395 Comm: syz-executor364 Not tainted 6.6.0-gd2f51b3516da #1
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
> RIP: 0010:usb_ep_queue+0xa0/0x300 linux/drivers/usb/gadget/udc/core.c:295
> Code: 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 31 02 00 00 0f b6
> 5d 35 31 ff 89 de e8 da 51 08 fa 84 db 74 11 e8 01 56 08 fa 90 <0f> 0b
> 90 41 bd 94 ff ff ff eb 56 e8 f0 55 08 fa 48 8d 7d 10 48 b8
> RSP: 0018:ffffc900075cfc00 EFLAGS: 00010093
> RAX: 0000000000000000 RBX: 0000000000000081 RCX: ffffffff8786e5a6
> RDX: ffff88801cd59e00 RSI: ffffffff8786e5af RDI: 0000000000000001
> RBP: ffff8880173d80e0 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000081 R11: 0000000000000000 R12: ffff888019236e10
> R13: 0000000000000820 R14: 0000000000000000 R15: ffff888019236e58
> FS:  000055555591d3c0(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000020c55000 CR3: 0000000024d03000 CR4: 0000000000350ef0
> Call Trace:
>  <TASK>
>  printer_write+0x650/0xf30 linux/drivers/usb/gadget/function/f_printer.c:669
>  vfs_write+0x2ae/0xd80 linux/fs/read_write.c:582
>  ksys_write+0x127/0x250 linux/fs/read_write.c:637
>  do_syscall_x64 linux/arch/x86/entry/common.c:51 [inline]
>  do_syscall_64+0x40/0x110 linux/arch/x86/entry/common.c:82
>  entry_SYSCALL_64_after_hwframe+0x63/0x6b
> RIP: 0033:0x7f1c4a60e3bd
> Code: c3 e8 87 20 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48
> 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
> 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007ffd3d68a858 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
> RAX: ffffffffffffffda RBX: 00000000000f4240 RCX: 00007f1c4a60e3bd
> RDX: 000000000000004f RSI: 00000000200000c0 RDI: 0000000000000003
> RBP: 0000000000000000 R08: 00007f1c4a663cd5 R09: 00007f1c4a663cd5
> R10: 00237265746e6972 R11: 0000000000000246 R12: 0000000000000001
> R13: 00007ffd3d68aab8 R14: 00007ffd3d68a880 R15: 00007ffd3d68a870
>  </TASK>
> ```
> 
> It seems that the `WARN_ON_ONCE(!ep->enabled && ep->address)` in
> usb_ep_queue (https://elixir.bootlin.com/linux/v6.7/source/drivers/usb/gadget/udc/core.c#L290),
> which is invoked by `printer_write`
> (https://elixir.bootlin.com/linux/v6.7/source/drivers/usb/gadget/function/f_printer.c#L669).
> 
> If you have any questions or require more information, please feel
> free to contact us.

Do you have a proposed patch that fixes this issue?  That's the simplest
way to get this resolved and to get credit for making the fix.

thanks,

greg k-h

  reply	other threads:[~2024-02-02 21:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 18:59 [Linux Kernel Bug][usb/f_printer] WARNING in usb_ep_queue Chenyuan Yang
2024-02-02 21:08 ` Greg KH [this message]
2024-03-13 15:17 ` Oliver Neukum

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=2024020256-contented-concave-92d0@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=azeemshaikh38@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=chenyuan0y@gmail.com \
    --cc=ivan.orlov0322@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=syzkaller@googlegroups.com \
    --cc=zzjas98@gmail.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