From: Alan Stern <stern@rowland.harvard.edu>
To: Sam Sun <samsun1006219@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Greg KH <gregkh@linuxfoundation.org>,
swboyd@chromium.org, ricardo@marliere.net, hkallweit1@gmail.com,
heikki.krogerus@linux.intel.com, mathias.nyman@linux.intel.com,
royluo@google.com, syzkaller-bugs@googlegroups.com,
xrivendell7@gmail.com
Subject: Re: [Linux kernel bug] general protection fault in disable_store
Date: Wed, 17 Apr 2024 10:23:51 -0400 [thread overview]
Message-ID: <de997acf-300a-4592-87c5-024171d19c29@rowland.harvard.edu> (raw)
In-Reply-To: <CAEkJfYMPQJn+kYzxFwwix3fwKeu3aAdYKgp+Ksvq=o4CoTXEWQ@mail.gmail.com>
On Wed, Apr 17, 2024 at 03:39:02PM +0800, Sam Sun wrote:
> On Wed, Apr 17, 2024 at 12:35 AM Alan Stern <stern@rowland.harvard.edu> wrote:
> > It turns out that patch is no good. The reason is mentioned in the
> > changelog for commit 543d7784b07f ("USB: fix race between hub_disconnect
> > and recursively_mark_NOTATTACHED"); it says that the port devices have to
> > be removed _after_ maxchild has been set to 0.
> >
>
> I checked the commit you mentioned. Maybe your first fix is all we
> need to fix the problem? At least no race would occur for
> hdev->maxchild and usb_set_intfdata().
No, the first patch won't help, even though it passed your testing. The
race it eliminates is a harmless one -- or at least, it's harmless in
this context. If usb_hub_to_struct_hub() sees bad values for
hdev->maxchild or usb_get_intfdata(), it will simply return NULL. But
this can happen even with the first patch applied, if the user tries to
access disable_store() during the brief time between when hdev->maxchild
is set to 0 and when the port devices are removed.
The true fix is simply to check whether the return value from
usb_hub_to_struct_hub() is NULL, which is what this patch does.
> I applied this patch and it also can fix the warning. I am not sure
> which one is better.
I'm quite sure that this one is better. I will submit it shortly, with
your Tested-by:.
Thanks a lot; the work you have done on this has been a big help.
Alan Stern
prev parent reply other threads:[~2024-04-17 14:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 6:52 [Linux kernel bug] general protection fault in disable_store Sam Sun
2024-04-11 6:58 ` Greg KH
2024-04-11 7:19 ` Sam Sun
2024-04-11 15:24 ` Alan Stern
2024-04-12 13:08 ` Sam Sun
2024-04-12 14:40 ` Alan Stern
2024-04-12 16:26 ` Sam Sun
2024-04-12 18:11 ` Alan Stern
2024-04-12 18:32 ` Alan Stern
2024-04-13 5:08 ` Sam Sun
2024-04-15 14:47 ` Alan Stern
2024-04-16 9:05 ` Sam Sun
2024-04-16 16:35 ` Alan Stern
2024-04-17 7:39 ` Sam Sun
2024-04-17 14:23 ` Alan Stern [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=de997acf-300a-4592-87c5-024171d19c29@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=ricardo@marliere.net \
--cc=royluo@google.com \
--cc=samsun1006219@gmail.com \
--cc=swboyd@chromium.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=xrivendell7@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 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.