Commit 986837ba authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jonathan Corbet

block-dasd_eer: BKL pushdown

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 9a8bd2f7
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -525,6 +526,7 @@ static int dasd_eer_open(struct inode *inp, struct file *filp) ...@@ -525,6 +526,7 @@ static int dasd_eer_open(struct inode *inp, struct file *filp)
eerb = kzalloc(sizeof(struct eerbuffer), GFP_KERNEL); eerb = kzalloc(sizeof(struct eerbuffer), GFP_KERNEL);
if (!eerb) if (!eerb)
return -ENOMEM; return -ENOMEM;
lock_kernel();
eerb->buffer_page_count = eer_pages; eerb->buffer_page_count = eer_pages;
if (eerb->buffer_page_count < 1 || if (eerb->buffer_page_count < 1 ||
eerb->buffer_page_count > INT_MAX / PAGE_SIZE) { eerb->buffer_page_count > INT_MAX / PAGE_SIZE) {
...@@ -532,6 +534,7 @@ static int dasd_eer_open(struct inode *inp, struct file *filp) ...@@ -532,6 +534,7 @@ static int dasd_eer_open(struct inode *inp, struct file *filp)
MESSAGE(KERN_WARNING, "can't open device since module " MESSAGE(KERN_WARNING, "can't open device since module "
"parameter eer_pages is smaller then 1 or" "parameter eer_pages is smaller then 1 or"
" bigger then %d", (int)(INT_MAX / PAGE_SIZE)); " bigger then %d", (int)(INT_MAX / PAGE_SIZE));
unlock_kernel();
return -EINVAL; return -EINVAL;
} }
eerb->buffersize = eerb->buffer_page_count * PAGE_SIZE; eerb->buffersize = eerb->buffer_page_count * PAGE_SIZE;
...@@ -539,12 +542,14 @@ static int dasd_eer_open(struct inode *inp, struct file *filp) ...@@ -539,12 +542,14 @@ static int dasd_eer_open(struct inode *inp, struct file *filp)
GFP_KERNEL); GFP_KERNEL);
if (!eerb->buffer) { if (!eerb->buffer) {
kfree(eerb); kfree(eerb);
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
if (dasd_eer_allocate_buffer_pages(eerb->buffer, if (dasd_eer_allocate_buffer_pages(eerb->buffer,
eerb->buffer_page_count)) { eerb->buffer_page_count)) {
kfree(eerb->buffer); kfree(eerb->buffer);
kfree(eerb); kfree(eerb);
unlock_kernel();
return -ENOMEM; return -ENOMEM;
} }
filp->private_data = eerb; filp->private_data = eerb;
...@@ -552,6 +557,7 @@ static int dasd_eer_open(struct inode *inp, struct file *filp) ...@@ -552,6 +557,7 @@ static int dasd_eer_open(struct inode *inp, struct file *filp)
list_add(&eerb->list, &bufferlist); list_add(&eerb->list, &bufferlist);
spin_unlock_irqrestore(&bufferlock, flags); spin_unlock_irqrestore(&bufferlock, flags);
unlock_kernel();
return nonseekable_open(inp,filp); return nonseekable_open(inp,filp);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment