aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/harddog_kern.c13
-rw-r--r--arch/um/drivers/hostaudio_kern.c12
-rw-r--r--arch/um/drivers/ubd_kern.c11
-rw-r--r--arch/um/kernel/exec.c2
4 files changed, 20 insertions, 18 deletions
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c
index cfcac1ff4cf2..86036276020f 100644
--- a/arch/um/drivers/harddog_kern.c
+++ b/arch/um/drivers/harddog_kern.c
@@ -42,7 +42,7 @@
42#include <linux/miscdevice.h> 42#include <linux/miscdevice.h>
43#include <linux/watchdog.h> 43#include <linux/watchdog.h>
44#include <linux/reboot.h> 44#include <linux/reboot.h>
45#include <linux/smp_lock.h> 45#include <linux/mutex.h>
46#include <linux/init.h> 46#include <linux/init.h>
47#include <linux/spinlock.h> 47#include <linux/spinlock.h>
48#include <asm/uaccess.h> 48#include <asm/uaccess.h>
@@ -50,6 +50,7 @@
50 50
51MODULE_LICENSE("GPL"); 51MODULE_LICENSE("GPL");
52 52
53static DEFINE_MUTEX(harddog_mutex);
53static DEFINE_SPINLOCK(lock); 54static DEFINE_SPINLOCK(lock);
54static int timer_alive; 55static int timer_alive;
55static int harddog_in_fd = -1; 56static int harddog_in_fd = -1;
@@ -66,7 +67,7 @@ static int harddog_open(struct inode *inode, struct file *file)
66 int err = -EBUSY; 67 int err = -EBUSY;
67 char *sock = NULL; 68 char *sock = NULL;
68 69
69 lock_kernel(); 70 mutex_lock(&harddog_mutex);
70 spin_lock(&lock); 71 spin_lock(&lock);
71 if(timer_alive) 72 if(timer_alive)
72 goto err; 73 goto err;
@@ -83,11 +84,11 @@ static int harddog_open(struct inode *inode, struct file *file)
83 84
84 timer_alive = 1; 85 timer_alive = 1;
85 spin_unlock(&lock); 86 spin_unlock(&lock);
86 unlock_kernel(); 87 mutex_unlock(&harddog_mutex);
87 return nonseekable_open(inode, file); 88 return nonseekable_open(inode, file);
88err: 89err:
89 spin_unlock(&lock); 90 spin_unlock(&lock);
90 unlock_kernel(); 91 mutex_unlock(&harddog_mutex);
91 return err; 92 return err;
92} 93}
93 94
@@ -153,9 +154,9 @@ static long harddog_ioctl(struct file *file,
153{ 154{
154 long ret; 155 long ret;
155 156
156 lock_kernel(); 157 mutex_lock(&harddog_mutex);
157 ret = harddog_ioctl_unlocked(file, cmd, arg); 158 ret = harddog_ioctl_unlocked(file, cmd, arg);
158 unlock_kernel(); 159 mutex_unlock(&harddog_mutex);
159 160
160 return ret; 161 return ret;
161} 162}
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index 63c740a85b4c..f9f6a4e20590 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -8,7 +8,7 @@
8#include "linux/slab.h" 8#include "linux/slab.h"
9#include "linux/sound.h" 9#include "linux/sound.h"
10#include "linux/soundcard.h" 10#include "linux/soundcard.h"
11#include "linux/smp_lock.h" 11#include "linux/mutex.h"
12#include "asm/uaccess.h" 12#include "asm/uaccess.h"
13#include "init.h" 13#include "init.h"
14#include "os.h" 14#include "os.h"
@@ -63,6 +63,8 @@ static int set_mixer(char *name, int *add)
63__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP); 63__uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP);
64#endif 64#endif
65 65
66static DEFINE_MUTEX(hostaudio_mutex);
67
66/* /dev/dsp file operations */ 68/* /dev/dsp file operations */
67 69
68static ssize_t hostaudio_read(struct file *file, char __user *buffer, 70static ssize_t hostaudio_read(struct file *file, char __user *buffer,
@@ -198,9 +200,9 @@ static int hostaudio_open(struct inode *inode, struct file *file)
198 w = 1; 200 w = 1;
199 201
200 kparam_block_sysfs_write(dsp); 202 kparam_block_sysfs_write(dsp);
201 lock_kernel(); 203 mutex_lock(&hostaudio_mutex);
202 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); 204 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
203 unlock_kernel(); 205 mutex_unlock(&hostaudio_mutex);
204 kparam_unblock_sysfs_write(dsp); 206 kparam_unblock_sysfs_write(dsp);
205 207
206 if (ret < 0) { 208 if (ret < 0) {
@@ -259,9 +261,9 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
259 w = 1; 261 w = 1;
260 262
261 kparam_block_sysfs_write(mixer); 263 kparam_block_sysfs_write(mixer);
262 lock_kernel(); 264 mutex_lock(&hostaudio_mutex);
263 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); 265 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
264 unlock_kernel(); 266 mutex_unlock(&hostaudio_mutex);
265 kparam_unblock_sysfs_write(mixer); 267 kparam_unblock_sysfs_write(mixer);
266 268
267 if (ret < 0) { 269 if (ret < 0) {
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 9734994cba1e..ba4a98ba39c0 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -33,7 +33,7 @@
33#include "linux/mm.h" 33#include "linux/mm.h"
34#include "linux/slab.h" 34#include "linux/slab.h"
35#include "linux/vmalloc.h" 35#include "linux/vmalloc.h"
36#include "linux/smp_lock.h" 36#include "linux/mutex.h"
37#include "linux/blkpg.h" 37#include "linux/blkpg.h"
38#include "linux/genhd.h" 38#include "linux/genhd.h"
39#include "linux/spinlock.h" 39#include "linux/spinlock.h"
@@ -100,6 +100,7 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
100#define DRIVER_NAME "uml-blkdev" 100#define DRIVER_NAME "uml-blkdev"
101 101
102static DEFINE_MUTEX(ubd_lock); 102static DEFINE_MUTEX(ubd_lock);
103static DEFINE_MUTEX(ubd_mutex); /* replaces BKL, might not be needed */
103 104
104static int ubd_open(struct block_device *bdev, fmode_t mode); 105static int ubd_open(struct block_device *bdev, fmode_t mode);
105static int ubd_release(struct gendisk *disk, fmode_t mode); 106static int ubd_release(struct gendisk *disk, fmode_t mode);
@@ -1101,7 +1102,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1101 struct ubd *ubd_dev = disk->private_data; 1102 struct ubd *ubd_dev = disk->private_data;
1102 int err = 0; 1103 int err = 0;
1103 1104
1104 lock_kernel(); 1105 mutex_lock(&ubd_mutex);
1105 if(ubd_dev->count == 0){ 1106 if(ubd_dev->count == 0){
1106 err = ubd_open_dev(ubd_dev); 1107 err = ubd_open_dev(ubd_dev);
1107 if(err){ 1108 if(err){
@@ -1120,7 +1121,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1120 err = -EROFS; 1121 err = -EROFS;
1121 }*/ 1122 }*/
1122out: 1123out:
1123 unlock_kernel(); 1124 mutex_unlock(&ubd_mutex);
1124 return err; 1125 return err;
1125} 1126}
1126 1127
@@ -1128,10 +1129,10 @@ static int ubd_release(struct gendisk *disk, fmode_t mode)
1128{ 1129{
1129 struct ubd *ubd_dev = disk->private_data; 1130 struct ubd *ubd_dev = disk->private_data;
1130 1131
1131 lock_kernel(); 1132 mutex_lock(&ubd_mutex);
1132 if(--ubd_dev->count == 0) 1133 if(--ubd_dev->count == 0)
1133 ubd_close_dev(ubd_dev); 1134 ubd_close_dev(ubd_dev);
1134 unlock_kernel(); 1135 mutex_unlock(&ubd_mutex);
1135 return 0; 1136 return 0;
1136} 1137}
1137 1138
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 49b5e1eb3262..340268be00b5 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -78,13 +78,11 @@ long sys_execve(const char __user *file, const char __user *const __user *argv,
78 long error; 78 long error;
79 char *filename; 79 char *filename;
80 80
81 lock_kernel();
82 filename = getname(file); 81 filename = getname(file);
83 error = PTR_ERR(filename); 82 error = PTR_ERR(filename);
84 if (IS_ERR(filename)) goto out; 83 if (IS_ERR(filename)) goto out;
85 error = execve1(filename, argv, env); 84 error = execve1(filename, argv, env);
86 putname(filename); 85 putname(filename);
87 out: 86 out:
88 unlock_kernel();
89 return error; 87 return error;
90} 88}