USB: gadget: don't wait for completion twice
authorFelipe Balbi <felipe.balbi@nokia.com>
Mon, 8 Dec 2008 11:50:27 +0000 (13:50 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Jan 2009 18:00:03 +0000 (10:00 -0800)
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 <felipe.balbi@nokia.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/file_storage.c

index 93933155e81c66894d35f74976cdb84146bb5c6c..b10fa31cc9157a8f60a538ac8da42946f366efdc 100644 (file)
@@ -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;
 }