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>
This commit is contained in:
parent
dfe8b29ad1
commit
9b68fb8b48
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue