Skip to content

Commit

Permalink
USB: gadgetfs: protect ep_release with lock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Milan Svoboda authored and Greg Kroah-Hartman committed Sep 27, 2006
1 parent 8a7471a commit ba307f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/usb/gadget/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down

0 comments on commit ba307f5

Please sign in to comment.