Commit 462265bf authored by Thomas Gleixner's avatar Thomas Gleixner Committed by David S. Miller

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 49ab972a
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/smp_lock.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
...@@ -75,7 +74,6 @@ static void riowd_writereg(struct riowd *p, u8 val, int index) ...@@ -75,7 +74,6 @@ static void riowd_writereg(struct riowd *p, u8 val, int index)
static int riowd_open(struct inode *inode, struct file *filp) static int riowd_open(struct inode *inode, struct file *filp)
{ {
cycle_kernel_lock();
nonseekable_open(inode, filp); nonseekable_open(inode, filp);
return 0; return 0;
} }
...@@ -194,6 +192,8 @@ static int __devinit riowd_probe(struct of_device *op, ...@@ -194,6 +192,8 @@ static int __devinit riowd_probe(struct of_device *op,
printk(KERN_ERR PFX "Cannot map registers.\n"); printk(KERN_ERR PFX "Cannot map registers.\n");
goto out_free; goto out_free;
} }
/* Make miscdev useable right away */
riowd_device = p;
err = misc_register(&riowd_miscdev); err = misc_register(&riowd_miscdev);
if (err) { if (err) {
...@@ -205,10 +205,10 @@ static int __devinit riowd_probe(struct of_device *op, ...@@ -205,10 +205,10 @@ static int __devinit riowd_probe(struct of_device *op,
"regs at %p\n", riowd_timeout, p->regs); "regs at %p\n", riowd_timeout, p->regs);
dev_set_drvdata(&op->dev, p); dev_set_drvdata(&op->dev, p);
riowd_device = p;
return 0; return 0;
out_iounmap: out_iounmap:
riowd_device = NULL;
of_iounmap(&op->resource[0], p->regs, 2); of_iounmap(&op->resource[0], p->regs, 2);
out_free: out_free:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment