From: Milan Svoboda Date: Mon, 26 Jun 2006 14:48:00 +0000 (-0700) Subject: USB: gadgetfs: protect ep_release with lock X-Git-Tag: v2.6.19-rc1~899^2~79 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba307f5828b1b4a1348d99c4f430a0cf3beeae2f;p=linux-2.6 USB: gadgetfs: protect ep_release with lock This patch adds mutex protection to ep_release. Signed-off-by: Milan Svoboda Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 72c88aa94d..ab508858f3 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; }