]> err.no Git - linux-2.6/commitdiff
phonedev: cdev lock_kernel() pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 15 May 2008 17:58:31 +0000 (11:58 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:48 +0000 (14:05 -0600)
phone_open() looks OK, but I don't trust the subsidiary drivers (and ixj in
particular).

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/telephony/phonedev.c

index bcea8d9b718ce782da7f1e3fdb20d4d278d9d00e..4d74ba36c3a12b0d8acd19cd7115b154522f862b 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/errno.h>
 #include <linux/phonedev.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
@@ -53,6 +54,7 @@ static int phone_open(struct inode *inode, struct file *file)
        if (minor >= PHONE_NUM_DEVICES)
                return -ENODEV;
 
+       lock_kernel();
        mutex_lock(&phone_lock);
        p = phone_device[minor];
        if (p)
@@ -79,6 +81,7 @@ static int phone_open(struct inode *inode, struct file *file)
        fops_put(old_fops);
 end:
        mutex_unlock(&phone_lock);
+       unlock_kernel();
        return err;
 }