public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_mass_storage: Shut down mass storage device when USB connection is shut, down.
@ 2021-09-04 15:32 Florian Faber
  2021-09-04 16:09 ` Alan Stern
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Faber @ 2021-09-04 15:32 UTC (permalink / raw)
  To: gregkh, linux-usb

f_mass_storage continues to send out packets after the connection to the 
USB host has been terminated, ignoring the error status.

Signed-off-by: Florian Faber <faber@faberman.de>

---
  drivers/usb/gadget/function/f_mass_storage.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/function/f_mass_storage.c 
b/drivers/usb/gadget/function/f_mass_storage.c
index 6ad669dde41c..1e73ba629e43 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -529,6 +529,10 @@ static int start_transfer(struct fsg_dev *fsg, 
struct usb_ep *ep,
  		/* We can't do much more than wait for a reset */
  		req->status = rc;

+		if (rc==-ESHUTDOWN) {
+			fsg->common->running = 0;
+		}
+
  		/*
  		 * Note: currently the net2280 driver fails zero-length
  		 * submissions if DMA is enabled.
-- 
2.33.0

Flo
-- 
Machines can do the work, so people have time to think.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-04 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-04 15:32 [PATCH] usb: gadget: f_mass_storage: Shut down mass storage device when USB connection is shut, down Florian Faber
2021-09-04 16:09 ` Alan Stern
2021-09-04 16:17   ` Florian Faber
2021-09-04 16:25     ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox