diff options
author | Milan Svoboda <msvoboda@ra.rockwell.com> | 2006-06-26 10:48:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 14:58:52 -0400 |
commit | ba307f5828b1b4a1348d99c4f430a0cf3beeae2f (patch) | |
tree | 86bc891c6be4b8e48da2f7806526ab3a15ee4aa9 /drivers/usb/gadget | |
parent | 8a7471aba19dc526978a03bfe2e3c122712b5900 (diff) |
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>
Diffstat (limited to 'drivers/usb/gadget')
-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 72c88aa94d5..ab508858f34 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -477,6 +477,10 @@ static int | |||
477 | ep_release (struct inode *inode, struct file *fd) | 477 | ep_release (struct inode *inode, struct file *fd) |
478 | { | 478 | { |
479 | struct ep_data *data = fd->private_data; | 479 | struct ep_data *data = fd->private_data; |
480 | int value; | ||
481 | |||
482 | if ((value = down_interruptible(&data->lock)) < 0) | ||
483 | return value; | ||
480 | 484 | ||
481 | /* clean up if this can be reopened */ | 485 | /* clean up if this can be reopened */ |
482 | if (data->state != STATE_EP_UNBOUND) { | 486 | if (data->state != STATE_EP_UNBOUND) { |
@@ -485,6 +489,7 @@ ep_release (struct inode *inode, struct file *fd) | |||
485 | data->hs_desc.bDescriptorType = 0; | 489 | data->hs_desc.bDescriptorType = 0; |
486 | usb_ep_disable(data->ep); | 490 | usb_ep_disable(data->ep); |
487 | } | 491 | } |
492 | up (&data->lock); | ||
488 | put_ep (data); | 493 | put_ep (data); |
489 | return 0; | 494 | return 0; |
490 | } | 495 | } |