]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: f_mass_storage: forbid async queue when shutdown happen
authoryuan linyu <yuanlinyu@hihonor.com>
Tue, 23 Jan 2024 03:48:29 +0000 (11:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:42:25 +0000 (08:42 +0100)
commitb8da59ad91e818b0510ee0e55fc4b288b0541391
treeeed8848f109c4f3348da3001eecd0e4c1ff77169
parent9a8ccbc6ecbf1abef988a9045bbc9661b46a31ad
usb: f_mass_storage: forbid async queue when shutdown happen

commit b2d2d7ea0dd09802cf5a0545bf54d8ad8987d20c upstream.

When write UDC to empty and unbind gadget driver from gadget device, it is
possible that there are many queue failures for mass storage function.

The root cause is mass storage main thread alaways try to queue request to
receive a command from host if running flag is on, on platform like dwc3,
if pull down called, it will not queue request again and return
-ESHUTDOWN, but it not affect running flag of mass storage function.

Check return code from mass storage function and clear running flag if it
is -ESHUTDOWN, also indicate start in/out transfer failure to break loops.

Cc: stable <stable@kernel.org>
Signed-off-by: yuan linyu <yuanlinyu@hihonor.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20240123034829.3848409-1-yuanlinyu@hihonor.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_mass_storage.c