Skip to content

Commit

Permalink
um: Remove BKL from mmapper
Browse files Browse the repository at this point in the history
cycle_kernel_lock() was added during the big BKL pushdown. It should
ensure the serializiation against driver init code.

mmapper_open() cannot be called before misc_register() succeeded, but
p_buf might be uninitialized.

Move the initialization of p_buf before the misc_register() call and
get rid of cycle_kernel_lock().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <20091010153349.682213670@linutronix.de>
Cc: Jeff Dike <jdike@addtoit.com>
  • Loading branch information
Thomas Gleixner committed Oct 14, 2009
1 parent df502e3 commit d63c489
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions arch/um/drivers/mmapper_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>

#include <asm/uaccess.h>
#include "mem_user.h"

Expand Down Expand Up @@ -78,7 +78,6 @@ static int mmapper_mmap(struct file *file, struct vm_area_struct *vma)

static int mmapper_open(struct inode *inode, struct file *file)
{
cycle_kernel_lock();
return 0;
}

Expand Down Expand Up @@ -115,18 +114,16 @@ static int __init mmapper_init(void)
v_buf = (char *) find_iomem("mmapper", &mmapper_size);
if (mmapper_size == 0) {
printk(KERN_ERR "mmapper_init - find_iomem failed\n");
goto out;
return -ENODEV;
}
p_buf = __pa(v_buf);

err = misc_register(&mmapper_dev);
if (err) {
printk(KERN_ERR "mmapper - misc_register failed, err = %d\n",
err);
goto out;
return err;;
}

p_buf = __pa(v_buf);
out:
return 0;
}

Expand Down

0 comments on commit d63c489

Please sign in to comment.