diff options
| author | Hemant Kumar <hemantk@codeaurora.org> | 2016-08-05 15:57:24 -0700 |
|---|---|---|
| committer | Hemant Kumar <hemantk@codeaurora.org> | 2016-08-08 09:35:15 -0700 |
| commit | 9b68fb8b48be1830a83c96a105d0fcc09a10a165 (patch) | |
| tree | a5f598d061daf29629253e2b905e30023faf8cc4 /drivers/usb | |
| parent | dfe8b29ad1dfb84411c3c897a619b44c4cbf8905 (diff) | |
usb: gadget: configfs: Synchronizing bind/unbind using mutex lock
Synchronization is required because bind/unbind can happen in two
different contexts. For example, function unbind due to
unregister_gadget_item can race with bind which is initiated from
sysfs.
Change-Id: Iec93a9d4cb2a10b833cbba0d5256b64161147de2
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Diffstat (limited to 'drivers/usb')
| -rw-r--r-- | drivers/usb/gadget/configfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 3639890c0dc7..5db4fe9e3cdf 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1738,7 +1738,10 @@ void unregister_gadget_item(struct config_item *item) { struct gadget_info *gi = to_gadget_info(item); + /* to protect race with gadget_dev_desc_UDC_store*/ + mutex_lock(&gi->lock); unregister_gadget(gi); + mutex_unlock(&gi->lock); } EXPORT_SYMBOL_GPL(unregister_gadget_item); |
