aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 18:24:25 -0400
committerJonathan Corbet <corbet@lwn.net>2008-06-20 16:05:49 -0400
commit20613f24bcd1cbfb08e64f0bb00c44481313b448 (patch)
tree766f9e57841470ea3cfdabb10b844a2b4112f5c7
parent1bcaa0bd6fd5b510dd9f1ba2da114d3f1253af61 (diff)
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>
-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 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/rwsem.h> 20#include <linux/rwsem.h>
21#include <linux/smp_lock.h>
21#include <linux/usb.h> 22#include <linux/usb.h>
22 23
23#include "usb.h" 24#include "usb.h"
@@ -33,6 +34,7 @@ static int usb_open(struct inode * inode, struct file * file)
33 int err = -ENODEV; 34 int err = -ENODEV;
34 const struct file_operations *old_fops, *new_fops = NULL; 35 const struct file_operations *old_fops, *new_fops = NULL;
35 36
37 lock_kernel();
36 down_read(&minor_rwsem); 38 down_read(&minor_rwsem);
37 c = usb_minors[minor]; 39 c = usb_minors[minor];
38 40
@@ -51,6 +53,7 @@ static int usb_open(struct inode * inode, struct file * file)
51 fops_put(old_fops); 53 fops_put(old_fops);
52 done: 54 done:
53 up_read(&minor_rwsem); 55 up_read(&minor_rwsem);
56 unlock_kernel();
54 return err; 57 return err;
55} 58}
56 59