phonedev: cdev lock_kernel() pushdown
phone_open() looks OK, but I don't trust the subsidiary drivers (and ixj in particular). Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/phonedev.h>
|
#include <linux/phonedev.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
#include <linux/smp_lock.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ static int phone_open(struct inode *inode, struct file *file)
|
|||||||
if (minor >= PHONE_NUM_DEVICES)
|
if (minor >= PHONE_NUM_DEVICES)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
mutex_lock(&phone_lock);
|
mutex_lock(&phone_lock);
|
||||||
p = phone_device[minor];
|
p = phone_device[minor];
|
||||||
if (p)
|
if (p)
|
||||||
@@ -79,6 +81,7 @@ static int phone_open(struct inode *inode, struct file *file)
|
|||||||
fops_put(old_fops);
|
fops_put(old_fops);
|
||||||
end:
|
end:
|
||||||
mutex_unlock(&phone_lock);
|
mutex_unlock(&phone_lock);
|
||||||
|
unlock_kernel();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user