From: Greg KH <gregkh@linuxfoundation.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Khazhy Kumykov <khazhy@google.com>,
USB mailing list <linux-usb@vger.kernel.org>
Subject: Re: [PATCH 0/3] USB: core: Don't overwrite device descriptor during reinitialization
Date: Tue, 8 Aug 2023 10:47:37 +0200 [thread overview]
Message-ID: <2023080828-frill-bullhorn-c646@gregkh> (raw)
In-Reply-To: <6eadec91-990a-4fbd-8883-8366c4a4d8e4@rowland.harvard.edu>
On Fri, Aug 04, 2023 at 03:09:04PM -0400, Alan Stern wrote:
> An outstanding syzbot bug report has been traced to a race between the
> routine that reads in the device descriptor for a device being
> reinitialized and the routine that writes the descriptors to a sysfs
> attribute file. The problem is that reinitializing a device, like
> initializing it for the first time, stores the device descriptor
> directly in the usb_device structure, where it may be accessed
> concurrently as part of sending the descriptors to the sysfs reader.
>
> This three-part series fixes the problem:
>
> The first patch unites the code paths responsible for first
> reading the device descriptor in hub.c's old scheme and new
> scheme, so that neither of them will call
> usb_get_device_descriptor().
>
> The second patch changes usb_get_device_descriptor(), making
> it return the descriptor in a dynamically allocated buffer
> rather than storing it directly in the device structure.
>
> The third patch changes hub_port_init(), adding a new argument
> that specifies a buffer in which to store the device
> descriptor for devices being reinitialized.
>
> As a result of these changes, the copy of the device descriptor stored
> in the usb_device structure will never be overwritten once it has been
> initialized. This eliminates the data race causing the bug identified
> by syzbot.
>
> It would be nice at some point to make a similar change to the code
> that reads the device's BOS descriptor; reinitialization should not
> overwrite its existing data either. This series doesn't attempt to do
> that, but it would be a good thing to do.
Thanks for cleaning this up, all now applied.
greg k-h
next prev parent reply other threads:[~2023-08-08 16:44 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 19:09 [PATCH 0/3] USB: core: Don't overwrite device descriptor during reinitialization Alan Stern
2023-08-04 19:10 ` [PATCH 1/3] USB: core: Unite old scheme and new scheme descriptor reads Alan Stern
2023-08-04 19:12 ` [PATCH 2/3] USB: core: Change usb_get_device_descriptor() API Alan Stern
2023-08-04 19:14 ` [PATCH 3/3] USB: core: Fix race by not overwriting udev->descriptor in hub_port_init() Alan Stern
2023-12-11 10:40 ` [REGRESSION] Re: [PATCH 1/3] USB: core: Unite old scheme and new scheme descriptor reads Christian Eggers
2023-12-11 16:21 ` Alan Stern
2023-12-12 8:01 ` Christian Eggers
2023-08-08 8:47 ` Greg KH [this message]
2023-08-10 0:28 ` [PATCH 0/3] USB: core: Don't overwrite device descriptor during reinitialization Thinh Nguyen
2023-08-10 1:47 ` Alan Stern
2023-08-10 16:34 ` Alan Stern
2023-08-10 22:39 ` Thinh Nguyen
2023-08-11 1:52 ` Alan Stern
2023-08-11 17:05 ` Thinh Nguyen
2023-08-11 17:38 ` [PATCH] USB: core: Fix oversight in SuperSpeed initialization Alan Stern
2023-08-12 8:05 ` Greg KH
2023-08-12 15:28 ` Alan Stern
2024-03-05 8:20 ` [REGRESSION] Re: [PATCH 0/3] USB: core: Don't overwrite device descriptor during reinitialization Jan Čermák
2024-03-06 21:08 ` Alan Stern
2024-03-07 16:17 ` Jan Čermák
2024-03-07 19:34 ` Alan Stern
2024-03-11 9:58 ` Jan Čermák
2024-03-11 14:43 ` Alan Stern
2024-03-12 8:57 ` Jan Čermák
2024-03-12 20:47 ` Alan Stern
2024-03-16 20:35 ` Alan Stern
2024-03-19 11:54 ` Jan Čermák
2024-03-19 16:03 ` Alan Stern
2024-03-27 13:24 ` Jan Čermák
2024-03-27 14:21 ` Alan Stern
2024-03-28 15:44 ` Alexander Dahl
2024-03-28 16:16 ` Alan Stern
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=2023080828-frill-bullhorn-c646@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=khazhy@google.com \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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