Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185343
b: refs/heads/master
c: 8626645
h: refs/heads/master
i:
  185341: c61df5b
  185339: c7dce58
  185335: f61b66f
  185327: 4fb788b
  185311: 1ae8789
  185279: 40ad4ac
  185215: 557348b
  185087: 24d08d0
  184831: 7d72d5c
  184319: e70477d
v: v3
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 40d9972 commit a57c266
Show file tree
Hide file tree
Showing 21 changed files with 100 additions and 16 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: f9de332ebf9df71892d52f7eb64af101a647349f
refs/heads/master: 86266452f80545285c14e20a8024f79c4fb88a86
7 changes: 5 additions & 2 deletions trunk/drivers/hid/usbhid/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,10 @@ static int hiddev_release(struct inode * inode, struct file * file)
static int hiddev_open(struct inode *inode, struct file *file)
{
struct hiddev_list *list;
int res;
int res, i;

int i = iminor(inode) - HIDDEV_MINOR_BASE;
lock_kernel();
i = iminor(inode) - HIDDEV_MINOR_BASE;

if (i >= HIDDEV_MINORS || i < 0 || !hiddev_table[i])
return -ENODEV;
Expand Down Expand Up @@ -313,10 +314,12 @@ static int hiddev_open(struct inode *inode, struct file *file)
usbhid_open(hid);
}

unlock_kernel();
return 0;
bail:
file->private_data = NULL;
kfree(list);
unlock_kernel();
return res;
}

Expand Down
8 changes: 7 additions & 1 deletion trunk/drivers/media/video/dabusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,12 @@ static int dabusb_open (struct inode *inode, struct file *file)
{
int devnum = iminor(inode);
pdabusb_t s;
int r;

if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
return -EIO;

lock_kernel();
s = &dabusb[devnum - DABUSB_MINOR];

dbg("dabusb_open");
Expand All @@ -634,13 +636,15 @@ static int dabusb_open (struct inode *inode, struct file *file)
msleep_interruptible(500);

if (signal_pending (current)) {
unlock_kernel();
return -EAGAIN;
}
mutex_lock(&s->mutex);
}
if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
mutex_unlock(&s->mutex);
dev_err(&s->usbdev->dev, "set_interface failed\n");
unlock_kernel();
return -EINVAL;
}
s->opened = 1;
Expand All @@ -649,7 +653,9 @@ static int dabusb_open (struct inode *inode, struct file *file)
file->f_pos = 0;
file->private_data = s;

return nonseekable_open(inode, file);
r = nonseekable_open(inode, file);
unlock_kernel();
return r;
}

static int dabusb_release (struct inode *inode, struct file *file)
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/staging/frontier/alphatrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <linux/mutex.h>

#include <linux/uaccess.h>
#include <linux/smp_lock.h>
#include <linux/input.h>
#include <linux/usb.h>
#include <linux/poll.h>
Expand Down Expand Up @@ -325,6 +326,7 @@ static int usb_alphatrack_open(struct inode *inode, struct file *file)
int retval = 0;
struct usb_interface *interface;

lock_kernel();
nonseekable_open(inode, file);
subminor = iminor(inode);

Expand Down Expand Up @@ -394,6 +396,7 @@ static int usb_alphatrack_open(struct inode *inode, struct file *file)

unlock_disconnect_exit:
mutex_unlock(&disconnect_mutex);
unlock_kernel();

return retval;
}
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/staging/frontier/tranzport.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <linux/mutex.h>

#include <linux/uaccess.h>
#include <linux/smp_lock.h>
#include <linux/input.h>
#include <linux/usb.h>
#include <linux/poll.h>
Expand Down Expand Up @@ -343,6 +344,7 @@ static int usb_tranzport_open(struct inode *inode, struct file *file)
int retval = 0;
struct usb_interface *interface;

lock_kernel();
nonseekable_open(inode, file);
subminor = iminor(inode);

Expand Down Expand Up @@ -413,6 +415,7 @@ static int usb_tranzport_open(struct inode *inode, struct file *file)

unlock_disconnect_exit:
mutex_unlock(&disconnect_mutex);
unlock_kernel();

return retval;
}
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/uaccess.h>
#include <linux/bitops.h>
#include <linux/poll.h>
#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/usb/cdc.h>
#include <asm/byteorder.h>
Expand Down Expand Up @@ -516,6 +517,7 @@ static int wdm_open(struct inode *inode, struct file *file)
struct usb_interface *intf;
struct wdm_device *desc;

lock_kernel();
mutex_lock(&wdm_mutex);
intf = usb_find_interface(&wdm_driver, minor);
if (!intf)
Expand Down Expand Up @@ -548,6 +550,7 @@ static int wdm_open(struct inode *inode, struct file *file)
usb_autopm_put_interface(desc->intf);
out:
mutex_unlock(&wdm_mutex);
unlock_kernel();
return rv;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/usb/class/usblp.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <linux/slab.h>
#include <linux/lp.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>
#undef DEBUG
#include <linux/usb.h>

Expand Down Expand Up @@ -395,6 +396,7 @@ static int usblp_open(struct inode *inode, struct file *file)
if (minor < 0)
return -ENODEV;

lock_kernel();
mutex_lock (&usblp_mutex);

retval = -ENODEV;
Expand Down Expand Up @@ -434,6 +436,7 @@ static int usblp_open(struct inode *inode, struct file *file)
}
out:
mutex_unlock (&usblp_mutex);
unlock_kernel();
return retval;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/usb/class/usbtmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/uaccess.h>
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/usb/tmc.h>

Expand Down Expand Up @@ -113,6 +114,7 @@ static int usbtmc_open(struct inode *inode, struct file *filp)
struct usbtmc_device_data *data;
int retval = 0;

lock_kernel();
intf = usb_find_interface(&usbtmc_driver, iminor(inode));
if (!intf) {
printk(KERN_ERR KBUILD_MODNAME
Expand All @@ -128,6 +130,7 @@ static int usbtmc_open(struct inode *inode, struct file *filp)
filp->private_data = data;

exit:
unlock_kernel();
return retval;
}

Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/usb/core/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ static int usb_open(struct inode * inode, struct file * file)
int err = -ENODEV;
const struct file_operations *old_fops, *new_fops = NULL;

lock_kernel();
down_read(&minor_rwsem);
c = usb_minors[minor];

Expand All @@ -53,7 +52,6 @@ static int usb_open(struct inode * inode, struct file * file)
fops_put(old_fops);
done:
up_read(&minor_rwsem);
unlock_kernel();
return err;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/usb/image/mdc800.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
#include <linux/module.h>
#include <linux/wait.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>

#include <linux/usb.h>
#include <linux/fs.h>
Expand Down Expand Up @@ -622,6 +623,7 @@ static int mdc800_device_open (struct inode* inode, struct file *file)
int retval=0;
int errn=0;

lock_kernel();
mutex_lock(&mdc800->io_lock);

if (mdc800->state == NOT_CONNECTED)
Expand Down Expand Up @@ -660,6 +662,7 @@ static int mdc800_device_open (struct inode* inode, struct file *file)

error_out:
mutex_unlock(&mdc800->io_lock);
unlock_kernel();
return errn;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/usb/misc/adutux.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>

#ifdef CONFIG_USB_DEBUG
Expand Down Expand Up @@ -274,6 +275,7 @@ static int adu_open(struct inode *inode, struct file *file)

dbg(2,"%s : enter", __func__);

lock_kernel();
subminor = iminor(inode);

if ((retval = mutex_lock_interruptible(&adutux_mutex))) {
Expand Down Expand Up @@ -332,6 +334,7 @@ static int adu_open(struct inode *inode, struct file *file)
exit_no_device:
mutex_unlock(&adutux_mutex);
exit_no_lock:
unlock_kernel();
dbg(2,"%s : leave, return value %d ", __func__, retval);
return retval;
}
Expand Down
15 changes: 12 additions & 3 deletions trunk/drivers/usb/misc/ftdi-elan.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <linux/module.h>
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/workqueue.h>
Expand Down Expand Up @@ -623,22 +624,30 @@ static void ftdi_elan_status_work(struct work_struct *work)
*/
static int ftdi_elan_open(struct inode *inode, struct file *file)
{
int subminor = iminor(inode);
struct usb_interface *interface = usb_find_interface(&ftdi_elan_driver,
subminor);
int subminor;
struct usb_interface *interface;

lock_kernel();
subminor = iminor(inode);
interface = usb_find_interface(&ftdi_elan_driver, subminor);

if (!interface) {
unlock_kernel();
printk(KERN_ERR "can't find device for minor %d\n", subminor);
return -ENODEV;
} else {
struct usb_ftdi *ftdi = usb_get_intfdata(interface);
if (!ftdi) {
unlock_kernel();
return -ENODEV;
} else {
if (down_interruptible(&ftdi->sw_lock)) {
unlock_kernel();
return -EINTR;
} else {
ftdi_elan_get_kref(ftdi);
file->private_data = ftdi;
unlock_kernel();
return 0;
}
}
Expand Down
8 changes: 7 additions & 1 deletion trunk/drivers/usb/misc/idmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/module.h>
#include <linux/completion.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>

Expand Down Expand Up @@ -226,16 +227,20 @@ static int idmouse_open(struct inode *inode, struct file *file)
struct usb_interface *interface;
int result;

lock_kernel();
/* get the interface from minor number and driver information */
interface = usb_find_interface (&idmouse_driver, iminor (inode));
if (!interface)
if (!interface) {
unlock_kernel();
return -ENODEV;
}

mutex_lock(&open_disc_mutex);
/* get the device information block from the interface */
dev = usb_get_intfdata(interface);
if (!dev) {
mutex_unlock(&open_disc_mutex);
unlock_kernel();
return -ENODEV;
}

Expand Down Expand Up @@ -272,6 +277,7 @@ static int idmouse_open(struct inode *inode, struct file *file)

/* unlock this device */
mutex_unlock(&dev->lock);
unlock_kernel();
return result;
}

Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/usb/misc/iowarrior.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,12 @@ static int iowarrior_open(struct inode *inode, struct file *file)

dbg("%s", __func__);

lock_kernel();
subminor = iminor(inode);

interface = usb_find_interface(&iowarrior_driver, subminor);
if (!interface) {
unlock_kernel();
err("%s - error, can't find device for minor %d", __func__,
subminor);
return -ENODEV;
Expand All @@ -615,6 +617,7 @@ static int iowarrior_open(struct inode *inode, struct file *file)
dev = usb_get_intfdata(interface);
if (!dev) {
mutex_unlock(&iowarrior_open_disc_lock);
unlock_kernel();
return -ENODEV;
}

Expand All @@ -641,6 +644,7 @@ static int iowarrior_open(struct inode *inode, struct file *file)

out:
mutex_unlock(&dev->mutex);
unlock_kernel();
return retval;
}

Expand Down
Loading

0 comments on commit a57c266

Please sign in to comment.