]> Pileus Git - ~andy/linux/blobdiff - drivers/char/mbcs.c
APM: fix deadlock in APM_IOC_SUSPEND ioctl
[~andy/linux] / drivers / char / mbcs.c
index 83bef4efe37636869f418756462516d00a4f3ccd..1aeaaba680d22e1e943995efeff6b0ed671c5fe8 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/mm.h>
 #include <linux/uio.h>
 #include <linux/mutex.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -42,6 +41,7 @@
 #else
 #define DBG(fmt...)
 #endif
+static DEFINE_MUTEX(mbcs_mutex);
 static int mbcs_major;
 
 static LIST_HEAD(soft_list);
@@ -385,19 +385,19 @@ static int mbcs_open(struct inode *ip, struct file *fp)
        struct mbcs_soft *soft;
        int minor;
 
-       lock_kernel();
+       mutex_lock(&mbcs_mutex);
        minor = iminor(ip);
 
        /* Nothing protects access to this list... */
        list_for_each_entry(soft, &soft_list, list) {
                if (soft->nasid == minor) {
                        fp->private_data = soft->cxdev;
-                       unlock_kernel();
+                       mutex_unlock(&mbcs_mutex);
                        return 0;
                }
        }
 
-       unlock_kernel();
+       mutex_unlock(&mbcs_mutex);
        return -ENODEV;
 }