[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60a358c9-b44b-4d25-9a20-aa9e00c65ab6@rowland.harvard.edu>
Date: Fri, 20 Oct 2023 11:46:49 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Douglas Anderson <dianders@...omium.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, Grant Grundler <grundler@...omium.org>,
Hayes Wang <hayeswang@...ltek.com>,
Bastien Nocera <hadess@...ess.net>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Flavio Suligoi <f.suligoi@...m.it>,
Hans de Goede <hdegoede@...hat.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Ivan Orlov <ivan.orlov0322@...il.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Ray Chi <raychi@...gle.com>,
Ricardo CaƱuelo
<ricardo.canuelo@...labora.com>, Rob Herring <robh@...nel.org>,
Roy Luo <royluo@...gle.com>,
Stanley Chang <stanley_chang@...ltek.com>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: core: Prevent infinite loops when
usb_reset_device() unbinds/binds
On Fri, Oct 20, 2023 at 08:31:38AM -0700, Douglas Anderson wrote:
> When we call usb_reset_device() and a driver doesn't implement
> pre_reset() and post_reset() methods then the USB core will attempt to
> unbind and rebind the driver in order to make reset work. This is a
> great general solution, but it has the potential to loop forever.
> Specifically, if the USB device is in a state that the USB device
> driver issues another usb_reset_device() after each rebind then we'll
> just continually unbind and rebind with no end.
>
> It's difficult to address this condition in a USB device driver
> because it's hard for the driver to keep state across each
> unbind/bind.
How about just adding appropriate pre_reset() and post_reset() methods?
This is precisely what they are meant for. Then the the unbind/rebind
loop wouldn't ever get started.
Alan Stern
Powered by blists - more mailing lists