Browse Source

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 <felipe.balbi@nokia.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi 16 years ago
parent
commit
889394b1eb
1 changed files with 1 additions and 0 deletions
  1. 1 0
      drivers/usb/gadget/file_storage.c

+ 1 - 0
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;
 }