diff mbox series

usb: gadget: f_mass_storage: Shut down mass storage device when USB connection is shut, down.

Message ID 5f9fbabd-2e2c-9389-446d-3bd1dd954a82@faberman.de
State New
Headers show
Series usb: gadget: f_mass_storage: Shut down mass storage device when USB connection is shut, down. | expand

Commit Message

Florian Faber Sept. 4, 2021, 3:32 p.m. UTC
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(+)

  		 * submissions if DMA is enabled.
diff mbox series

Patch

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