summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 16:24:25 -0600
committerJonathan Corbet <corbet@lwn.net>2008-06-20 14:05:49 -0600
commit20613f24bcd1cbfb08e64f0bb00c44481313b448 (patch)
tree766f9e57841470ea3cfdabb10b844a2b4112f5c7 /drivers/usb/core
parent1bcaa0bd6fd5b510dd9f1ba2da114d3f1253af61 (diff)
downloadblackbird-op-linux-20613f24bcd1cbfb08e64f0bb00c44481313b448.tar.gz
blackbird-op-linux-20613f24bcd1cbfb08e64f0bb00c44481313b448.zip
usbcore: cdev lock_kernel() pushdown
usb_open() is protected by a down_read(&minor_rwsem), but I'm not sure I trust it to protect everything including subsidiary open() functions. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 8133c99c6c5c..c6a95395e52a 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/rwsem.h>
+#include <linux/smp_lock.h>
#include <linux/usb.h>
#include "usb.h"
@@ -33,6 +34,7 @@ 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];
@@ -51,6 +53,7 @@ static int usb_open(struct inode * inode, struct file * file)
fops_put(old_fops);
done:
up_read(&minor_rwsem);
+ unlock_kernel();
return err;
}
OpenPOWER on IntegriCloud