diff options
author | Oliver Neukum <oliver@neukum.org> | 2010-01-13 15:33:15 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 14:54:23 -0800 |
commit | 86266452f80545285c14e20a8024f79c4fb88a86 (patch) | |
tree | ebb0a287f9bf189737d4924536d18b36492fd330 /drivers/usb/misc/ldusb.c | |
parent | f9de332ebf9df71892d52f7eb64af101a647349f (diff) | |
download | op-kernel-dev-86266452f80545285c14e20a8024f79c4fb88a86.zip op-kernel-dev-86266452f80545285c14e20a8024f79c4fb88a86.tar.gz |
USB: Push BKL on open down into the drivers
Straightforward push into the drivers to allow
auditing individual drivers separately
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/ldusb.c')
-rw-r--r-- | drivers/usb/misc/ldusb.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 7c0bd13..8de32df 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -33,6 +33,7 @@ #include <linux/slab.h> #include <linux/module.h> #include <linux/mutex.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> #include <linux/input.h> @@ -296,12 +297,14 @@ static int ld_usb_open(struct inode *inode, struct file *file) int retval; struct usb_interface *interface; + lock_kernel(); nonseekable_open(inode, file); subminor = iminor(inode); interface = usb_find_interface(&ld_usb_driver, subminor); if (!interface) { + unlock_kernel(); err("%s - error, can't find device for minor %d\n", __func__, subminor); return -ENODEV; @@ -309,12 +312,16 @@ static int ld_usb_open(struct inode *inode, struct file *file) dev = usb_get_intfdata(interface); - if (!dev) + if (!dev) { + unlock_kernel(); return -ENODEV; + } /* lock this device */ - if (mutex_lock_interruptible(&dev->mutex)) + if (mutex_lock_interruptible(&dev->mutex)) { + unlock_kernel(); return -ERESTARTSYS; + } /* allow opening only once */ if (dev->open_count) { @@ -353,6 +360,7 @@ static int ld_usb_open(struct inode *inode, struct file *file) unlock_exit: mutex_unlock(&dev->mutex); + unlock_kernel(); return retval; } |