We are launching the mass-storage thread during the function configuration phase, in case of failure adding function to stop the thread. Signed-off-by: Sanjay Singh Rawat <snjsrwt@xxxxxxxxx> --- drivers/usb/gadget/legacy/acm_ms.c | 2 ++ drivers/usb/gadget/legacy/mass_storage.c | 1 + drivers/usb/gadget/legacy/multi.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c index ec79c74..bbdb867 100644 --- a/drivers/usb/gadget/legacy/acm_ms.c +++ b/drivers/usb/gadget/legacy/acm_ms.c @@ -15,6 +15,7 @@ */ #include <linux/kernel.h> +#include <linux/kthread.h> #include <linux/module.h> #include "u_serial.h" @@ -160,6 +161,7 @@ static int acm_ms_do_config(struct usb_configuration *c) return 0; remove_acm: + kthread_stop(opts->common->thread_task); usb_remove_function(c, f_acm); put_msg: usb_put_function(f_msg); diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index a8746b9..ee1f61f 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c +++ b/drivers/usb/gadget/legacy/mass_storage.c @@ -160,6 +160,7 @@ static int msg_do_config(struct usb_configuration *c) return 0; put_func: + kthread_stop(opts->common->thread_task); usb_put_function(f_msg); return ret; } diff --git a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c index 00af0da..f9d8d13 100644 --- a/drivers/usb/gadget/legacy/multi.c +++ b/drivers/usb/gadget/legacy/multi.c @@ -14,6 +14,7 @@ #include <linux/kernel.h> +#include <linux/kthread.h> #include <linux/module.h> #include <linux/netdevice.h> @@ -196,6 +197,7 @@ static int rndis_do_config(struct usb_configuration *c) wake_up_process(fsg_opts->common->thread_task); return 0; err_run: + kthread_stop(fsg_opts->common->thread_task); usb_put_function(f_msg_rndis); err_fsg: usb_remove_function(c, f_acm_rndis); -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html