diff options
author | Milan Svoboda <msvoboda@ra.rockwell.com> | 2006-06-26 16:48:00 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 20:58:52 +0200 |
commit | ba307f5828b1b4a1348d99c4f430a0cf3beeae2f (patch) | |
tree | 86bc891c6be4b8e48da2f7806526ab3a15ee4aa9 | |
parent | USB: fix ep_config to return correct value (diff) | |
download | linux-ba307f5828b1b4a1348d99c4f430a0cf3beeae2f.tar.xz linux-ba307f5828b1b4a1348d99c4f430a0cf3beeae2f.zip |
USB: gadgetfs: protect ep_release with lock
This patch adds mutex protection to ep_release.
Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/gadget/inode.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 72c88aa94d5d..ab508858f341 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -477,6 +477,10 @@ static int ep_release (struct inode *inode, struct file *fd) { struct ep_data *data = fd->private_data; + int value; + + if ((value = down_interruptible(&data->lock)) < 0) + return value; /* clean up if this can be reopened */ if (data->state != STATE_EP_UNBOUND) { @@ -485,6 +489,7 @@ ep_release (struct inode *inode, struct file *fd) data->hs_desc.bDescriptorType = 0; usb_ep_disable(data->ep); } + up (&data->lock); put_ep (data); return 0; } |