From: Alan Stern <stern@rowland.harvard.edu>
To: Keisuke Tsukuda <catnyaaan@outlook.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"syzbot+a83a5a1ba9ff57935171@syzkaller.appspotmail.com"
<syzbot+a83a5a1ba9ff57935171@syzkaller.appspotmail.com>,
"syzbot+d31109047baed8f3b590@syzkaller.appspotmail.com"
<syzbot+d31109047baed8f3b590@syzkaller.appspotmail.com>
Subject: Re: [PATCH 2/2] usb: gadget: f_mass_storage: ignore class requests while inactive
Date: Tue, 8 Sep 2026 10:28:41 -0400 [thread overview]
Message-ID: <142bb935-adef-4881-adb4-f1ba158e7130@rowland.harvard.edu> (raw)
In-Reply-To: <20260907085806.52647-3-tkdkei@outlook.jp>
On Mon, Sep 07, 2026 at 08:58:42AM +0000, Keisuke Tsukuda wrote:
> SET_CONFIGURATION is handled asynchronously by the mass-storage thread.
> A class request can arrive after the composite core selects the function
> but before the thread installs common->fsg, or while the function is being
> disabled.
>
> fsg_setup() already rejects this state with -EOPNOTSUPP, but checking it
> through fsg_is_set() also emits a warning. Check the active function
> directly so normal requests during a configuration transition are rejected
> without hiding fsg_is_set() warnings from other internal paths.
>
> Fixes: 8876f5e7d3b2 ("USB: gadget: f_mass_storage: added eject callback")
> Reported-by: syzbot+d31109047baed8f3b590@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=d31109047baed8f3b590
> Signed-off-by: Keisuke Tsukuda <tkdkei@outlook.jp>
> ---
> drivers/usb/gadget/function/f_mass_storage.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
> index a50743c..52d486a 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -463,7 +463,7 @@ static int fsg_setup(struct usb_function *f,
> u16 w_value = le16_to_cpu(ctrl->wValue);
> u16 w_length = le16_to_cpu(ctrl->wLength);
>
> - if (!fsg_is_set(fsg->common))
> + if (!fsg->common->fsg)
I'd feel better about this if there was a comment here explaining why
calling fsg_is_set() is a bad idea.
Alan Stern
> return -EOPNOTSUPP;
>
> ++fsg->common->ep0_req_tag; /* Record arrival of a new request */
> --
> 2.50.1 (Apple Git-155)
>
>
next prev parent reply other threads:[~2026-09-08 14:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 8:58 [PATCH 0/2] usb: gadget: avoid warnings during configuration transitions Keisuke Tsukuda
2026-09-07 8:58 ` [PATCH 1/2] usb: gadget: composite: avoid warning on aborted delayed status Keisuke Tsukuda
2026-09-07 8:58 ` [PATCH 2/2] usb: gadget: f_mass_storage: ignore class requests while inactive Keisuke Tsukuda
2026-09-08 14:28 ` Alan Stern [this message]
2026-09-08 20:27 ` Keisuke Tsukuda
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=142bb935-adef-4881-adb4-f1ba158e7130@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=catnyaaan@outlook.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=syzbot+a83a5a1ba9ff57935171@syzkaller.appspotmail.com \
--cc=syzbot+d31109047baed8f3b590@syzkaller.appspotmail.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