From 889394b1eb95f040525d06dd4f2f1222b94023e2 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Mon, 8 Dec 2008 13:50:27 +0200 Subject: [PATCH] USB: gadget: don't wait for completion twice In some obscure scenarios e.g. passing a 0-byte backing file storage, wait_for_completion() would wait forever in fsg_cleanup(). Prevent it by completing the thread in fsg_bind() error path. Signed-off-by: Felipe Balbi Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/file_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 93933155e81c..b10fa31cc915 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -4182,6 +4182,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) fsg->state = FSG_STATE_TERMINATED; // The thread is dead fsg_unbind(gadget); close_all_backing_files(fsg); + complete(&fsg->thread_notifier); return rc; } -- GitLab