Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212921
b: refs/heads/master
c: 9a181c5
h: refs/heads/master
i:
  212919: 8ab49a9
v: v3
  • Loading branch information
Arnd Bergmann committed Oct 19, 2010
1 parent e9a6b44 commit ee503d7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa0d4c26be9f989816b30626f6c67d9e7ef867f8
refs/heads/master: 9a181c58617134822ae596339dbea076ef9b5cf7
13 changes: 7 additions & 6 deletions trunk/arch/um/drivers/harddog_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/reboot.h>
#include <linux/smp_lock.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include "mconsole.h"

MODULE_LICENSE("GPL");

static DEFINE_MUTEX(harddog_mutex);
static DEFINE_SPINLOCK(lock);
static int timer_alive;
static int harddog_in_fd = -1;
Expand All @@ -66,7 +67,7 @@ static int harddog_open(struct inode *inode, struct file *file)
int err = -EBUSY;
char *sock = NULL;

lock_kernel();
mutex_lock(&harddog_mutex);
spin_lock(&lock);
if(timer_alive)
goto err;
Expand All @@ -83,11 +84,11 @@ static int harddog_open(struct inode *inode, struct file *file)

timer_alive = 1;
spin_unlock(&lock);
unlock_kernel();
mutex_unlock(&harddog_mutex);
return nonseekable_open(inode, file);
err:
spin_unlock(&lock);
unlock_kernel();
mutex_unlock(&harddog_mutex);
return err;
}

Expand Down Expand Up @@ -153,9 +154,9 @@ static long harddog_ioctl(struct file *file,
{
long ret;

lock_kernel();
mutex_lock(&harddog_mutex);
ret = harddog_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
mutex_unlock(&harddog_mutex);

return ret;
}
Expand Down
12 changes: 7 additions & 5 deletions trunk/arch/um/drivers/hostaudio_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "linux/slab.h"
#include "linux/sound.h"
#include "linux/soundcard.h"
#include "linux/smp_lock.h"
#include "linux/mutex.h"
#include "asm/uaccess.h"
#include "init.h"
#include "os.h"
Expand Down Expand Up @@ -67,6 +67,8 @@ MODULE_PARM_DESC(mixer, MIXER_HELP);

#endif

static DEFINE_MUTEX(hostaudio_mutex);

/* /dev/dsp file operations */

static ssize_t hostaudio_read(struct file *file, char __user *buffer,
Expand Down Expand Up @@ -202,9 +204,9 @@ static int hostaudio_open(struct inode *inode, struct file *file)
w = 1;

kparam_block_sysfs_write(dsp);
lock_kernel();
mutex_lock(&hostaudio_mutex);
ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);
unlock_kernel();
mutex_unlock(&hostaudio_mutex);
kparam_unblock_sysfs_write(dsp);

if (ret < 0) {
Expand Down Expand Up @@ -263,9 +265,9 @@ static int hostmixer_open_mixdev(struct inode *inode, struct file *file)
w = 1;

kparam_block_sysfs_write(mixer);
lock_kernel();
mutex_lock(&hostaudio_mutex);
ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);
unlock_kernel();
mutex_unlock(&hostaudio_mutex);
kparam_unblock_sysfs_write(mixer);

if (ret < 0) {
Expand Down
11 changes: 6 additions & 5 deletions trunk/arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "linux/mm.h"
#include "linux/slab.h"
#include "linux/vmalloc.h"
#include "linux/smp_lock.h"
#include "linux/mutex.h"
#include "linux/blkpg.h"
#include "linux/genhd.h"
#include "linux/spinlock.h"
Expand Down Expand Up @@ -100,6 +100,7 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
#define DRIVER_NAME "uml-blkdev"

static DEFINE_MUTEX(ubd_lock);
static DEFINE_MUTEX(ubd_mutex); /* replaces BKL, might not be needed */

static int ubd_open(struct block_device *bdev, fmode_t mode);
static int ubd_release(struct gendisk *disk, fmode_t mode);
Expand Down Expand Up @@ -1099,7 +1100,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
struct ubd *ubd_dev = disk->private_data;
int err = 0;

lock_kernel();
mutex_lock(&ubd_mutex);
if(ubd_dev->count == 0){
err = ubd_open_dev(ubd_dev);
if(err){
Expand All @@ -1118,18 +1119,18 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
err = -EROFS;
}*/
out:
unlock_kernel();
mutex_unlock(&ubd_mutex);
return err;
}

static int ubd_release(struct gendisk *disk, fmode_t mode)
{
struct ubd *ubd_dev = disk->private_data;

lock_kernel();
mutex_lock(&ubd_mutex);
if(--ubd_dev->count == 0)
ubd_close_dev(ubd_dev);
unlock_kernel();
mutex_unlock(&ubd_mutex);
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/um/kernel/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@ long sys_execve(const char __user *file, char __user *__user *argv,
long error;
char *filename;

lock_kernel();
filename = getname(file);
error = PTR_ERR(filename);
if (IS_ERR(filename)) goto out;
error = execve1(filename, argv, env);
putname(filename);
out:
unlock_kernel();
return error;
}

0 comments on commit ee503d7

Please sign in to comment.