summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/f_mass_storage.h
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2016-04-08 10:24:11 +0200
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-04-19 11:11:56 +0300
commitf78bbcae86e676fad9e6c6bb6cd9d9868ba23696 (patch)
tree2320b3212fa699313f41f1268bc517c1b77ede81 /drivers/usb/gadget/function/f_mass_storage.h
parent332a5b446b7916d272c2a659a3b20909ce34d2c1 (diff)
downloadop-kernel-dev-f78bbcae86e676fad9e6c6bb6cd9d9868ba23696.zip
op-kernel-dev-f78bbcae86e676fad9e6c6bb6cd9d9868ba23696.tar.gz
usb: f_mass_storage: test whether thread is running before starting another
When binding the function to usb_configuration, check whether the thread is running before starting another one. Without that, when function instance is added to multiple configurations, fsg_bing starts multiple threads with all but the latest one being forgotten by the driver. This leads to obvious thread leaks, possible lockups when trying to halt the machine and possible more issues. This fixes issues with legacy/multi¹ gadget as well as configfs gadgets when mass_storage function is added to multiple configurations. This change also simplifies API since the legacy gadgets no longer need to worry about starting the thread by themselves (which was where bug in legacy/multi was in the first place). N.B., this patch doesn’t address adding single mass_storage function instance to a single configuration twice. Thankfully, there’s no legitimate reason for such setup plus, if I’m not mistaken, configfs gadget doesn’t even allow it to be expressed. ¹ I have no example failure though. Conclusion that legacy/multi has a bug is based purely on me reading the code. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: <stable@vger.kernel.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/gadget/function/f_mass_storage.h')
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_mass_storage.h b/drivers/usb/gadget/function/f_mass_storage.h
index 445df67..b6a9918 100644
--- a/drivers/usb/gadget/function/f_mass_storage.h
+++ b/drivers/usb/gadget/function/f_mass_storage.h
@@ -153,8 +153,6 @@ int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg);
void fsg_common_set_inquiry_string(struct fsg_common *common, const char *vn,
const char *pn);
-int fsg_common_run_thread(struct fsg_common *common);
-
void fsg_config_from_params(struct fsg_config *cfg,
const struct fsg_module_parameters *params,
unsigned int fsg_num_buffers);
OpenPOWER on IntegriCloud