提交 ba307f58 编写于 作者: M Milan Svoboda 提交者: Greg Kroah-Hartman

USB: gadgetfs: protect ep_release with lock

This patch adds mutex protection to ep_release.
Signed-off-by: NMilan Svoboda <msvoboda@ra.rockwell.com>
Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 8a7471ab
...@@ -477,6 +477,10 @@ static int ...@@ -477,6 +477,10 @@ static int
ep_release (struct inode *inode, struct file *fd) ep_release (struct inode *inode, struct file *fd)
{ {
struct ep_data *data = fd->private_data; 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 */ /* clean up if this can be reopened */
if (data->state != STATE_EP_UNBOUND) { if (data->state != STATE_EP_UNBOUND) {
...@@ -485,6 +489,7 @@ ep_release (struct inode *inode, struct file *fd) ...@@ -485,6 +489,7 @@ ep_release (struct inode *inode, struct file *fd)
data->hs_desc.bDescriptorType = 0; data->hs_desc.bDescriptorType = 0;
usb_ep_disable(data->ep); usb_ep_disable(data->ep);
} }
up (&data->lock);
put_ep (data); put_ep (data);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册