Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72586
b: refs/heads/master
c: 03f36e8
h: refs/heads/master
v: v3
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Oct 25, 2007
1 parent 66af5d6 commit 85d665b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5919a43bbc649f4770b8b5db33f43136c7ff3153
refs/heads/master: 03f36e885fc26cb0ea299fb6df5171a51e814548
9 changes: 8 additions & 1 deletion trunk/drivers/usb/misc/iowarrior.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module_param(debug, bool, 0644);
MODULE_PARM_DESC(debug, "debug=1 enables debugging messages");

static struct usb_driver iowarrior_driver;
static DEFINE_MUTEX(iowarrior_open_disc_lock);

/*--------------*/
/* data */
Expand Down Expand Up @@ -608,11 +609,15 @@ static int iowarrior_open(struct inode *inode, struct file *file)
return -ENODEV;
}

mutex_lock(&iowarrior_open_disc_lock);
dev = usb_get_intfdata(interface);
if (!dev)
if (!dev) {
mutex_unlock(&iowarrior_open_disc_lock);
return -ENODEV;
}

mutex_lock(&dev->mutex);
mutex_unlock(&iowarrior_open_disc_lock);

/* Only one process can open each device, no sharing. */
if (dev->opened) {
Expand Down Expand Up @@ -866,6 +871,7 @@ static void iowarrior_disconnect(struct usb_interface *interface)
int minor;

dev = usb_get_intfdata(interface);
mutex_lock(&iowarrior_open_disc_lock);
usb_set_intfdata(interface, NULL);

minor = dev->minor;
Expand All @@ -879,6 +885,7 @@ static void iowarrior_disconnect(struct usb_interface *interface)
dev->present = 0;

mutex_unlock(&dev->mutex);
mutex_unlock(&iowarrior_open_disc_lock);

if (dev->opened) {
/* There is a process that holds a filedescriptor to the device ,
Expand Down

0 comments on commit 85d665b

Please sign in to comment.