diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-11-03 00:16:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-03 00:16:28 -0500 |
commit | 462265bf494c4f2a2f6e06480590becadecbfea7 (patch) | |
tree | ab2a6a5232c2ed90bd93a350811ed7e4019ff8d8 | |
parent | 49ab972aea7fca7b94f9df0f1f077fdab40a825d (diff) |
watchdog: Remove BKL from rio watchdog driver
cycle_kernel_lock() was added with the BKL pushdown. The rio driver
indeed needs that because riowd_device is initialized after
misc_register(). So an open(), write/ioctl() which happens to get
between misc_register returning and riowd_device initialization would
dereference a NULL pointer.
Move riowd_device initialization before misc_register() and get rid of
cycle_kernel_lock().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/watchdog/riowd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index d3c824dc2358..c14ae8676903 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/miscdevice.h> | 12 | #include <linux/miscdevice.h> |
13 | #include <linux/smp_lock.h> | ||
14 | #include <linux/watchdog.h> | 13 | #include <linux/watchdog.h> |
15 | #include <linux/of.h> | 14 | #include <linux/of.h> |
16 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
@@ -75,7 +74,6 @@ static void riowd_writereg(struct riowd *p, u8 val, int index) | |||
75 | 74 | ||
76 | static int riowd_open(struct inode *inode, struct file *filp) | 75 | static int riowd_open(struct inode *inode, struct file *filp) |
77 | { | 76 | { |
78 | cycle_kernel_lock(); | ||
79 | nonseekable_open(inode, filp); | 77 | nonseekable_open(inode, filp); |
80 | return 0; | 78 | return 0; |
81 | } | 79 | } |
@@ -194,6 +192,8 @@ static int __devinit riowd_probe(struct of_device *op, | |||
194 | printk(KERN_ERR PFX "Cannot map registers.\n"); | 192 | printk(KERN_ERR PFX "Cannot map registers.\n"); |
195 | goto out_free; | 193 | goto out_free; |
196 | } | 194 | } |
195 | /* Make miscdev useable right away */ | ||
196 | riowd_device = p; | ||
197 | 197 | ||
198 | err = misc_register(&riowd_miscdev); | 198 | err = misc_register(&riowd_miscdev); |
199 | if (err) { | 199 | if (err) { |
@@ -205,10 +205,10 @@ static int __devinit riowd_probe(struct of_device *op, | |||
205 | "regs at %p\n", riowd_timeout, p->regs); | 205 | "regs at %p\n", riowd_timeout, p->regs); |
206 | 206 | ||
207 | dev_set_drvdata(&op->dev, p); | 207 | dev_set_drvdata(&op->dev, p); |
208 | riowd_device = p; | ||
209 | return 0; | 208 | return 0; |
210 | 209 | ||
211 | out_iounmap: | 210 | out_iounmap: |
211 | riowd_device = NULL; | ||
212 | of_iounmap(&op->resource[0], p->regs, 2); | 212 | of_iounmap(&op->resource[0], p->regs, 2); |
213 | 213 | ||
214 | out_free: | 214 | out_free: |