From 764a4a8e54cdd6efc5928f876aa9e35778f22377 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Thu, 15 May 2008 10:01:17 -0600 Subject: drivers/s390: cdev lock_kernel() pushdown Signed-off-by: Jonathan Corbet --- drivers/s390/char/fs3270.c | 23 ++++++++++++++++------- drivers/s390/char/tape_char.c | 12 +++++++++--- drivers/s390/char/vmlogrdr.c | 8 +++++++- drivers/s390/char/vmur.c | 12 +++++++++--- 4 files changed, 41 insertions(+), 14 deletions(-) (limited to 'drivers/s390/char') diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index ef36f2132aa..b5ecd59676c 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -421,6 +422,7 @@ fs3270_open(struct inode *inode, struct file *filp) if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR) return -ENODEV; + lock_kernel(); minor = iminor(filp->f_path.dentry->d_inode); /* Check for minor 0 multiplexer. */ if (minor == 0) { @@ -429,7 +431,8 @@ fs3270_open(struct inode *inode, struct file *filp) tty = get_current_tty(); if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) { mutex_unlock(&tty_mutex); - return -ENODEV; + rc = -ENODEV; + goto out; } minor = tty->index + RAW3270_FIRSTMINOR; mutex_unlock(&tty_mutex); @@ -438,19 +441,22 @@ fs3270_open(struct inode *inode, struct file *filp) fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor); if (!IS_ERR(fp)) { raw3270_put_view(&fp->view); - return -EBUSY; + rc = -EBUSY; + goto out; } /* Allocate fullscreen view structure. */ fp = fs3270_alloc_view(); - if (IS_ERR(fp)) - return PTR_ERR(fp); + if (IS_ERR(fp)) { + rc = PTR_ERR(fp); + goto out; + } init_waitqueue_head(&fp->wait); fp->fs_pid = get_pid(task_pid(current)); rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); if (rc) { fs3270_free_view(&fp->view); - return rc; + goto out; } /* Allocate idal-buffer. */ @@ -458,7 +464,8 @@ fs3270_open(struct inode *inode, struct file *filp) if (IS_ERR(ib)) { raw3270_put_view(&fp->view); raw3270_del_view(&fp->view); - return PTR_ERR(fp); + rc = PTR_ERR(fp); + goto out; } fp->rdbuf = ib; @@ -466,9 +473,11 @@ fs3270_open(struct inode *inode, struct file *filp) if (rc) { raw3270_put_view(&fp->view); raw3270_del_view(&fp->view); - return rc; + goto out; } filp->private_data = fp; +out: + unlock_kernel(); return 0; } diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index ebe84067bae..687720b552d 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -289,21 +290,26 @@ tapechar_open (struct inode *inode, struct file *filp) if (imajor(filp->f_path.dentry->d_inode) != tapechar_major) return -ENODEV; + lock_kernel(); minor = iminor(filp->f_path.dentry->d_inode); device = tape_get_device(minor / TAPE_MINORS_PER_DEV); if (IS_ERR(device)) { DBF_EVENT(3, "TCHAR:open: tape_get_device() failed\n"); - return PTR_ERR(device); + rc = PTR_ERR(device); + goto out; } rc = tape_open(device); if (rc == 0) { filp->private_data = device; - return nonseekable_open(inode, filp); + rc = nonseekable_open(inode, filp); } - tape_put_device(device); + else + tape_put_device(device); +out: + unlock_kernel(); return rc; } diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index e8487347e4d..d101328a298 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -319,9 +320,11 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp) return -ENOSYS; /* Besure this device hasn't already been opened */ + lock_kernel(); spin_lock_bh(&logptr->priv_lock); if (logptr->dev_in_use) { spin_unlock_bh(&logptr->priv_lock); + unlock_kernel(); return -EBUSY; } logptr->dev_in_use = 1; @@ -365,7 +368,9 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp) || (logptr->iucv_path_severed)); if (logptr->iucv_path_severed) goto out_record; - return nonseekable_open(inode, filp); + ret = nonseekable_open(inode, filp); + unlock_kernel(); + return ret; out_record: if (logptr->autorecording) @@ -375,6 +380,7 @@ out_path: logptr->path = NULL; out_dev: logptr->dev_in_use = 0; + unlock_kernel(); return -EIO; } diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 83ae9a852f0..61549987ed7 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c @@ -9,6 +9,7 @@ */ #include +#include #include #include @@ -668,7 +669,7 @@ static int ur_open(struct inode *inode, struct file *file) if (accmode == O_RDWR) return -EACCES; - + lock_kernel(); /* * We treat the minor number as the devno of the ur device * to find in the driver tree. @@ -676,8 +677,10 @@ static int ur_open(struct inode *inode, struct file *file) devno = MINOR(file->f_dentry->d_inode->i_rdev); urd = urdev_get_from_devno(devno); - if (!urd) - return -ENXIO; + if (!urd) { + rc = -ENXIO; + goto out; + } spin_lock(&urd->open_lock); while (urd->open_flag) { @@ -720,6 +723,7 @@ static int ur_open(struct inode *inode, struct file *file) goto fail_urfile_free; urf->file_reclen = rc; file->private_data = urf; + unlock_kernel(); return 0; fail_urfile_free: @@ -730,6 +734,8 @@ fail_unlock: spin_unlock(&urd->open_lock); fail_put: urdev_put(urd); +out: + unlock_kernel(); return rc; } -- cgit From 6ce46a435a3ac9e706d09a3075cbc60ed72d37db Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 20 May 2008 19:16:17 +0200 Subject: monreader: BKL pushdown [jmc: added ] Signed-off-by: Arnd Bergmann Signed-off-by: Jonathan Corbet --- drivers/s390/char/monreader.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/s390/char') diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index 1e1f50655bb..dc4710e64e0 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -340,6 +341,7 @@ static int mon_open(struct inode *inode, struct file *filp) /* * only one user allowed */ + lock_kernel(); rc = -EBUSY; if (test_and_set_bit(MON_IN_USE, &mon_in_use)) goto out; @@ -377,6 +379,7 @@ static int mon_open(struct inode *inode, struct file *filp) } P_INFO("open, established connection to *MONITOR service\n\n"); filp->private_data = monpriv; + unlock_kernel(); return nonseekable_open(inode, filp); out_path: @@ -386,6 +389,7 @@ out_priv: out_use: clear_bit(MON_IN_USE, &mon_in_use); out: + unlock_kernel(); return rc; } -- cgit From dca67e9d3db27b090259b696e1166615f40099e2 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 20 May 2008 19:16:18 +0200 Subject: monwriter: BKL pushdown Signed-off-by: Arnd Bergmann --- drivers/s390/char/monwriter.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/s390/char') diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c index a86c0534cd4..4d71aa8c1a7 100644 --- a/drivers/s390/char/monwriter.c +++ b/drivers/s390/char/monwriter.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -179,10 +180,12 @@ static int monwrite_open(struct inode *inode, struct file *filp) monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL); if (!monpriv) return -ENOMEM; + lock_kernel(); INIT_LIST_HEAD(&monpriv->list); monpriv->hdr_to_read = sizeof(monpriv->hdr); mutex_init(&monpriv->thread_mutex); filp->private_data = monpriv; + unlock_kernel(); return nonseekable_open(inode, filp); } -- cgit From 6c111d886317513605c459cbe8d1970fab732c90 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 20 May 2008 19:16:59 +0200 Subject: vmcp: BKL pushdown Signed-off-by: Arnd Bergmann --- drivers/s390/char/vmcp.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/s390/char') diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c index 2f419b0ea62..bf3dc6e0e33 100644 --- a/drivers/s390/char/vmcp.c +++ b/drivers/s390/char/vmcp.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -39,11 +40,14 @@ static int vmcp_open(struct inode *inode, struct file *file) session = kmalloc(sizeof(*session), GFP_KERNEL); if (!session) return -ENOMEM; + + lock_kernel(); session->bufsize = PAGE_SIZE; session->response = NULL; session->resp_size = 0; mutex_init(&session->mutex); file->private_data = session; + unlock_kernel(); return nonseekable_open(inode, file); } -- cgit From 3e0420f066c632e135939ccf218ae793e02dccd7 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 20 May 2008 19:17:01 +0200 Subject: vmwatchdog: BKL pushdown Signed-off-by: Arnd Bergmann --- drivers/s390/char/vmwatchdog.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/s390/char') diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c index 19f8389291b..ee80e936d51 100644 --- a/drivers/s390/char/vmwatchdog.c +++ b/drivers/s390/char/vmwatchdog.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -131,11 +132,15 @@ static int __init vmwdt_probe(void) static int vmwdt_open(struct inode *i, struct file *f) { int ret; - if (test_and_set_bit(0, &vmwdt_is_open)) + lock_kernel(); + if (test_and_set_bit(0, &vmwdt_is_open)) { + unlock_kernel(); return -EBUSY; + } ret = vmwdt_keepalive(); if (ret) clear_bit(0, &vmwdt_is_open); + unlock_kernel(); return ret ? ret : nonseekable_open(i, f); } -- cgit