Commit 889394b1 authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

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: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 619b572a
...@@ -4182,6 +4182,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) ...@@ -4182,6 +4182,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
fsg->state = FSG_STATE_TERMINATED; // The thread is dead fsg->state = FSG_STATE_TERMINATED; // The thread is dead
fsg_unbind(gadget); fsg_unbind(gadget);
close_all_backing_files(fsg); close_all_backing_files(fsg);
complete(&fsg->thread_notifier);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment