From: Felipe Balbi Date: Mon, 8 Dec 2008 11:50:27 +0000 (+0200) Subject: USB: gadget: don't wait for completion twice X-Git-Tag: v2.6.29-rc1~182^2~65 X-Git-Url: http://bbs.cooldavid.org/git/?a=commitdiff_plain;h=889394b1eb95f040525d06dd4f2f1222b94023e2;p=net-next-2.6.git 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 --- diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 93933155e81..b10fa31cc91 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -4182,6 +4182,7 @@ out: fsg->state = FSG_STATE_TERMINATED; // The thread is dead fsg_unbind(gadget); close_all_backing_files(fsg); + complete(&fsg->thread_notifier); return rc; }