Skip to content

Commit

Permalink
USB: gadget: don't wait for completion twice
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Jan 7, 2009
1 parent 619b572 commit 889394b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/file_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 889394b

Please sign in to comment.