diff options
| -rw-r--r-- | arch/um/drivers/harddog_kern.c | 13 | ||||
| -rw-r--r-- | arch/um/drivers/hostaudio_kern.c | 12 | ||||
| -rw-r--r-- | arch/um/drivers/ubd_kern.c | 11 | ||||
| -rw-r--r-- | arch/um/kernel/exec.c | 2 |
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 | ||
| 51 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
| 52 | 52 | ||
| 53 | static DEFINE_MUTEX(harddog_mutex); | ||
| 53 | static DEFINE_SPINLOCK(lock); | 54 | static DEFINE_SPINLOCK(lock); |
| 54 | static int timer_alive; | 55 | static int timer_alive; |
| 55 | static int harddog_in_fd = -1; | 56 | static 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); |
| 88 | err: | 89 | err: |
| 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 0c46e398cd8f..d92ff6d60297 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" |
| @@ -67,6 +67,8 @@ MODULE_PARM_DESC(mixer, MIXER_HELP); | |||
| 67 | 67 | ||
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | static DEFINE_MUTEX(hostaudio_mutex); | ||
| 71 | |||
| 70 | /* /dev/dsp file operations */ | 72 | /* /dev/dsp file operations */ |
| 71 | 73 | ||
| 72 | static ssize_t hostaudio_read(struct file *file, char __user *buffer, | 74 | static ssize_t hostaudio_read(struct file *file, char __user *buffer, |
| @@ -202,9 +204,9 @@ static int hostaudio_open(struct inode *inode, struct file *file) | |||
| 202 | w = 1; | 204 | w = 1; |
| 203 | 205 | ||
| 204 | kparam_block_sysfs_write(dsp); | 206 | kparam_block_sysfs_write(dsp); |
| 205 | lock_kernel(); | 207 | mutex_lock(&hostaudio_mutex); |
| 206 | ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); | 208 | ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); |
| 207 | unlock_kernel(); | 209 | mutex_unlock(&hostaudio_mutex); |
| 208 | kparam_unblock_sysfs_write(dsp); | 210 | kparam_unblock_sysfs_write(dsp); |
| 209 | 211 | ||
| 210 | if (ret < 0) { | 212 | if (ret < 0) { |
| @@ -263,9 +265,9 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file) | |||
| 263 | w = 1; | 265 | w = 1; |
| 264 | 266 | ||
| 265 | kparam_block_sysfs_write(mixer); | 267 | kparam_block_sysfs_write(mixer); |
| 266 | lock_kernel(); | 268 | mutex_lock(&hostaudio_mutex); |
| 267 | ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); | 269 | ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); |
| 268 | unlock_kernel(); | 270 | mutex_unlock(&hostaudio_mutex); |
| 269 | kparam_unblock_sysfs_write(mixer); | 271 | kparam_unblock_sysfs_write(mixer); |
| 270 | 272 | ||
| 271 | if (ret < 0) { | 273 | if (ret < 0) { |
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 1bcd208c459f..0c053607ce98 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 | ||
| 102 | static DEFINE_MUTEX(ubd_lock); | 102 | static DEFINE_MUTEX(ubd_lock); |
| 103 | static DEFINE_MUTEX(ubd_mutex); /* replaces BKL, might not be needed */ | ||
| 103 | 104 | ||
| 104 | static int ubd_open(struct block_device *bdev, fmode_t mode); | 105 | static int ubd_open(struct block_device *bdev, fmode_t mode); |
| 105 | static int ubd_release(struct gendisk *disk, fmode_t mode); | 106 | static int ubd_release(struct gendisk *disk, fmode_t mode); |
| @@ -1099,7 +1100,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode) | |||
| 1099 | struct ubd *ubd_dev = disk->private_data; | 1100 | struct ubd *ubd_dev = disk->private_data; |
| 1100 | int err = 0; | 1101 | int err = 0; |
| 1101 | 1102 | ||
| 1102 | lock_kernel(); | 1103 | mutex_lock(&ubd_mutex); |
| 1103 | if(ubd_dev->count == 0){ | 1104 | if(ubd_dev->count == 0){ |
| 1104 | err = ubd_open_dev(ubd_dev); | 1105 | err = ubd_open_dev(ubd_dev); |
| 1105 | if(err){ | 1106 | if(err){ |
| @@ -1118,7 +1119,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode) | |||
| 1118 | err = -EROFS; | 1119 | err = -EROFS; |
| 1119 | }*/ | 1120 | }*/ |
| 1120 | out: | 1121 | out: |
| 1121 | unlock_kernel(); | 1122 | mutex_unlock(&ubd_mutex); |
| 1122 | return err; | 1123 | return err; |
| 1123 | } | 1124 | } |
| 1124 | 1125 | ||
| @@ -1126,10 +1127,10 @@ static int ubd_release(struct gendisk *disk, fmode_t mode) | |||
| 1126 | { | 1127 | { |
| 1127 | struct ubd *ubd_dev = disk->private_data; | 1128 | struct ubd *ubd_dev = disk->private_data; |
| 1128 | 1129 | ||
| 1129 | lock_kernel(); | 1130 | mutex_lock(&ubd_mutex); |
| 1130 | if(--ubd_dev->count == 0) | 1131 | if(--ubd_dev->count == 0) |
| 1131 | ubd_close_dev(ubd_dev); | 1132 | ubd_close_dev(ubd_dev); |
| 1132 | unlock_kernel(); | 1133 | mutex_unlock(&ubd_mutex); |
| 1133 | return 0; | 1134 | return 0; |
| 1134 | } | 1135 | } |
| 1135 | 1136 | ||
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index cd145eda3579..460ce86f4019 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
| @@ -78,13 +78,11 @@ long sys_execve(const char __user *file, char __user *__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 | } |
