aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char')
-rw-r--r--drivers/s390/char/fs3270.c23
-rw-r--r--drivers/s390/char/monreader.c4
-rw-r--r--drivers/s390/char/monwriter.c3
-rw-r--r--drivers/s390/char/tape_char.c12
-rw-r--r--drivers/s390/char/vmcp.c4
-rw-r--r--drivers/s390/char/vmlogrdr.c8
-rw-r--r--drivers/s390/char/vmur.c12
-rw-r--r--drivers/s390/char/vmwatchdog.c7
8 files changed, 58 insertions, 15 deletions
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
index e136d10a0de6..d18e6d2e0b49 100644
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -14,6 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/smp_lock.h>
17 18
18#include <asm/ccwdev.h> 19#include <asm/ccwdev.h>
19#include <asm/cio.h> 20#include <asm/cio.h>
@@ -421,6 +422,7 @@ fs3270_open(struct inode *inode, struct file *filp)
421 422
422 if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR) 423 if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR)
423 return -ENODEV; 424 return -ENODEV;
425 lock_kernel();
424 minor = iminor(filp->f_path.dentry->d_inode); 426 minor = iminor(filp->f_path.dentry->d_inode);
425 /* Check for minor 0 multiplexer. */ 427 /* Check for minor 0 multiplexer. */
426 if (minor == 0) { 428 if (minor == 0) {
@@ -429,7 +431,8 @@ fs3270_open(struct inode *inode, struct file *filp)
429 tty = get_current_tty(); 431 tty = get_current_tty();
430 if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) { 432 if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) {
431 mutex_unlock(&tty_mutex); 433 mutex_unlock(&tty_mutex);
432 return -ENODEV; 434 rc = -ENODEV;
435 goto out;
433 } 436 }
434 minor = tty->index + RAW3270_FIRSTMINOR; 437 minor = tty->index + RAW3270_FIRSTMINOR;
435 mutex_unlock(&tty_mutex); 438 mutex_unlock(&tty_mutex);
@@ -438,19 +441,22 @@ fs3270_open(struct inode *inode, struct file *filp)
438 fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor); 441 fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor);
439 if (!IS_ERR(fp)) { 442 if (!IS_ERR(fp)) {
440 raw3270_put_view(&fp->view); 443 raw3270_put_view(&fp->view);
441 return -EBUSY; 444 rc = -EBUSY;
445 goto out;
442 } 446 }
443 /* Allocate fullscreen view structure. */ 447 /* Allocate fullscreen view structure. */
444 fp = fs3270_alloc_view(); 448 fp = fs3270_alloc_view();
445 if (IS_ERR(fp)) 449 if (IS_ERR(fp)) {
446 return PTR_ERR(fp); 450 rc = PTR_ERR(fp);
451 goto out;
452 }
447 453
448 init_waitqueue_head(&fp->wait); 454 init_waitqueue_head(&fp->wait);
449 fp->fs_pid = get_pid(task_pid(current)); 455 fp->fs_pid = get_pid(task_pid(current));
450 rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); 456 rc = raw3270_add_view(&fp->view, &fs3270_fn, minor);
451 if (rc) { 457 if (rc) {
452 fs3270_free_view(&fp->view); 458 fs3270_free_view(&fp->view);
453 return rc; 459 goto out;
454 } 460 }
455 461
456 /* Allocate idal-buffer. */ 462 /* Allocate idal-buffer. */
@@ -458,7 +464,8 @@ fs3270_open(struct inode *inode, struct file *filp)
458 if (IS_ERR(ib)) { 464 if (IS_ERR(ib)) {
459 raw3270_put_view(&fp->view); 465 raw3270_put_view(&fp->view);
460 raw3270_del_view(&fp->view); 466 raw3270_del_view(&fp->view);
461 return PTR_ERR(fp); 467 rc = PTR_ERR(fp);
468 goto out;
462 } 469 }
463 fp->rdbuf = ib; 470 fp->rdbuf = ib;
464 471
@@ -466,9 +473,11 @@ fs3270_open(struct inode *inode, struct file *filp)
466 if (rc) { 473 if (rc) {
467 raw3270_put_view(&fp->view); 474 raw3270_put_view(&fp->view);
468 raw3270_del_view(&fp->view); 475 raw3270_del_view(&fp->view);
469 return rc; 476 goto out;
470 } 477 }
471 filp->private_data = fp; 478 filp->private_data = fp;
479out:
480 unlock_kernel();
472 return 0; 481 return 0;
473} 482}
474 483
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c
index f0e4c96afbf8..35fd8dfcaaa6 100644
--- a/drivers/s390/char/monreader.c
+++ b/drivers/s390/char/monreader.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/moduleparam.h> 11#include <linux/moduleparam.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/smp_lock.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
14#include <linux/types.h> 15#include <linux/types.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -291,6 +292,7 @@ static int mon_open(struct inode *inode, struct file *filp)
291 /* 292 /*
292 * only one user allowed 293 * only one user allowed
293 */ 294 */
295 lock_kernel();
294 rc = -EBUSY; 296 rc = -EBUSY;
295 if (test_and_set_bit(MON_IN_USE, &mon_in_use)) 297 if (test_and_set_bit(MON_IN_USE, &mon_in_use))
296 goto out; 298 goto out;
@@ -327,6 +329,7 @@ static int mon_open(struct inode *inode, struct file *filp)
327 goto out_path; 329 goto out_path;
328 } 330 }
329 filp->private_data = monpriv; 331 filp->private_data = monpriv;
332 unlock_kernel();
330 return nonseekable_open(inode, filp); 333 return nonseekable_open(inode, filp);
331 334
332out_path: 335out_path:
@@ -336,6 +339,7 @@ out_priv:
336out_use: 339out_use:
337 clear_bit(MON_IN_USE, &mon_in_use); 340 clear_bit(MON_IN_USE, &mon_in_use);
338out: 341out:
342 unlock_kernel();
339 return rc; 343 return rc;
340} 344}
341 345
diff --git a/drivers/s390/char/monwriter.c b/drivers/s390/char/monwriter.c
index a86c0534cd49..4d71aa8c1a79 100644
--- a/drivers/s390/char/monwriter.c
+++ b/drivers/s390/char/monwriter.c
@@ -12,6 +12,7 @@
12#include <linux/moduleparam.h> 12#include <linux/moduleparam.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/smp_lock.h>
15#include <linux/types.h> 16#include <linux/types.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
@@ -179,10 +180,12 @@ static int monwrite_open(struct inode *inode, struct file *filp)
179 monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL); 180 monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL);
180 if (!monpriv) 181 if (!monpriv)
181 return -ENOMEM; 182 return -ENOMEM;
183 lock_kernel();
182 INIT_LIST_HEAD(&monpriv->list); 184 INIT_LIST_HEAD(&monpriv->list);
183 monpriv->hdr_to_read = sizeof(monpriv->hdr); 185 monpriv->hdr_to_read = sizeof(monpriv->hdr);
184 mutex_init(&monpriv->thread_mutex); 186 mutex_init(&monpriv->thread_mutex);
185 filp->private_data = monpriv; 187 filp->private_data = monpriv;
188 unlock_kernel();
186 return nonseekable_open(inode, filp); 189 return nonseekable_open(inode, filp);
187} 190}
188 191
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
index ebe84067bae9..687720b552d1 100644
--- a/drivers/s390/char/tape_char.c
+++ b/drivers/s390/char/tape_char.c
@@ -14,6 +14,7 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
16#include <linux/mtio.h> 16#include <linux/mtio.h>
17#include <linux/smp_lock.h>
17 18
18#include <asm/uaccess.h> 19#include <asm/uaccess.h>
19 20
@@ -289,21 +290,26 @@ tapechar_open (struct inode *inode, struct file *filp)
289 if (imajor(filp->f_path.dentry->d_inode) != tapechar_major) 290 if (imajor(filp->f_path.dentry->d_inode) != tapechar_major)
290 return -ENODEV; 291 return -ENODEV;
291 292
293 lock_kernel();
292 minor = iminor(filp->f_path.dentry->d_inode); 294 minor = iminor(filp->f_path.dentry->d_inode);
293 device = tape_get_device(minor / TAPE_MINORS_PER_DEV); 295 device = tape_get_device(minor / TAPE_MINORS_PER_DEV);
294 if (IS_ERR(device)) { 296 if (IS_ERR(device)) {
295 DBF_EVENT(3, "TCHAR:open: tape_get_device() failed\n"); 297 DBF_EVENT(3, "TCHAR:open: tape_get_device() failed\n");
296 return PTR_ERR(device); 298 rc = PTR_ERR(device);
299 goto out;
297 } 300 }
298 301
299 302
300 rc = tape_open(device); 303 rc = tape_open(device);
301 if (rc == 0) { 304 if (rc == 0) {
302 filp->private_data = device; 305 filp->private_data = device;
303 return nonseekable_open(inode, filp); 306 rc = nonseekable_open(inode, filp);
304 } 307 }
305 tape_put_device(device); 308 else
309 tape_put_device(device);
306 310
311out:
312 unlock_kernel();
307 return rc; 313 return rc;
308} 314}
309 315
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
index 401ea84b3059..09e7d9bf438b 100644
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/smp_lock.h>
19#include <asm/cpcmd.h> 20#include <asm/cpcmd.h>
20#include <asm/debug.h> 21#include <asm/debug.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
@@ -39,11 +40,14 @@ static int vmcp_open(struct inode *inode, struct file *file)
39 session = kmalloc(sizeof(*session), GFP_KERNEL); 40 session = kmalloc(sizeof(*session), GFP_KERNEL);
40 if (!session) 41 if (!session)
41 return -ENOMEM; 42 return -ENOMEM;
43
44 lock_kernel();
42 session->bufsize = PAGE_SIZE; 45 session->bufsize = PAGE_SIZE;
43 session->response = NULL; 46 session->response = NULL;
44 session->resp_size = 0; 47 session->resp_size = 0;
45 mutex_init(&session->mutex); 48 mutex_init(&session->mutex);
46 file->private_data = session; 49 file->private_data = session;
50 unlock_kernel();
47 return nonseekable_open(inode, file); 51 return nonseekable_open(inode, file);
48} 52}
49 53
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index a246bc73ae64..c31faefa2b3b 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -25,6 +25,7 @@
25#include <linux/kmod.h> 25#include <linux/kmod.h>
26#include <linux/cdev.h> 26#include <linux/cdev.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/smp_lock.h>
28#include <linux/string.h> 29#include <linux/string.h>
29 30
30 31
@@ -310,9 +311,11 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp)
310 return -ENOSYS; 311 return -ENOSYS;
311 312
312 /* Besure this device hasn't already been opened */ 313 /* Besure this device hasn't already been opened */
314 lock_kernel();
313 spin_lock_bh(&logptr->priv_lock); 315 spin_lock_bh(&logptr->priv_lock);
314 if (logptr->dev_in_use) { 316 if (logptr->dev_in_use) {
315 spin_unlock_bh(&logptr->priv_lock); 317 spin_unlock_bh(&logptr->priv_lock);
318 unlock_kernel();
316 return -EBUSY; 319 return -EBUSY;
317 } 320 }
318 logptr->dev_in_use = 1; 321 logptr->dev_in_use = 1;
@@ -356,7 +359,9 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp)
356 || (logptr->iucv_path_severed)); 359 || (logptr->iucv_path_severed));
357 if (logptr->iucv_path_severed) 360 if (logptr->iucv_path_severed)
358 goto out_record; 361 goto out_record;
359 return nonseekable_open(inode, filp); 362 ret = nonseekable_open(inode, filp);
363 unlock_kernel();
364 return ret;
360 365
361out_record: 366out_record:
362 if (logptr->autorecording) 367 if (logptr->autorecording)
@@ -366,6 +371,7 @@ out_path:
366 logptr->path = NULL; 371 logptr->path = NULL;
367out_dev: 372out_dev:
368 logptr->dev_in_use = 0; 373 logptr->dev_in_use = 0;
374 unlock_kernel();
369 return -EIO; 375 return -EIO;
370} 376}
371 377
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 49cba9effe89..0a9f1cccbe58 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/cdev.h> 11#include <linux/cdev.h>
12#include <linux/smp_lock.h>
12 13
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14#include <asm/cio.h> 15#include <asm/cio.h>
@@ -669,7 +670,7 @@ static int ur_open(struct inode *inode, struct file *file)
669 670
670 if (accmode == O_RDWR) 671 if (accmode == O_RDWR)
671 return -EACCES; 672 return -EACCES;
672 673 lock_kernel();
673 /* 674 /*
674 * We treat the minor number as the devno of the ur device 675 * We treat the minor number as the devno of the ur device
675 * to find in the driver tree. 676 * to find in the driver tree.
@@ -677,8 +678,10 @@ static int ur_open(struct inode *inode, struct file *file)
677 devno = MINOR(file->f_dentry->d_inode->i_rdev); 678 devno = MINOR(file->f_dentry->d_inode->i_rdev);
678 679
679 urd = urdev_get_from_devno(devno); 680 urd = urdev_get_from_devno(devno);
680 if (!urd) 681 if (!urd) {
681 return -ENXIO; 682 rc = -ENXIO;
683 goto out;
684 }
682 685
683 spin_lock(&urd->open_lock); 686 spin_lock(&urd->open_lock);
684 while (urd->open_flag) { 687 while (urd->open_flag) {
@@ -721,6 +724,7 @@ static int ur_open(struct inode *inode, struct file *file)
721 goto fail_urfile_free; 724 goto fail_urfile_free;
722 urf->file_reclen = rc; 725 urf->file_reclen = rc;
723 file->private_data = urf; 726 file->private_data = urf;
727 unlock_kernel();
724 return 0; 728 return 0;
725 729
726fail_urfile_free: 730fail_urfile_free:
@@ -731,6 +735,8 @@ fail_unlock:
731 spin_unlock(&urd->open_lock); 735 spin_unlock(&urd->open_lock);
732fail_put: 736fail_put:
733 urdev_put(urd); 737 urdev_put(urd);
738out:
739 unlock_kernel();
734 return rc; 740 return rc;
735} 741}
736 742
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c
index 56b3eab019cb..21a2a829bf4e 100644
--- a/drivers/s390/char/vmwatchdog.c
+++ b/drivers/s390/char/vmwatchdog.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
15#include <linux/watchdog.h> 15#include <linux/watchdog.h>
16#include <linux/smp_lock.h>
16 17
17#include <asm/ebcdic.h> 18#include <asm/ebcdic.h>
18#include <asm/io.h> 19#include <asm/io.h>
@@ -121,11 +122,15 @@ static int __init vmwdt_probe(void)
121static int vmwdt_open(struct inode *i, struct file *f) 122static int vmwdt_open(struct inode *i, struct file *f)
122{ 123{
123 int ret; 124 int ret;
124 if (test_and_set_bit(0, &vmwdt_is_open)) 125 lock_kernel();
126 if (test_and_set_bit(0, &vmwdt_is_open)) {
127 unlock_kernel();
125 return -EBUSY; 128 return -EBUSY;
129 }
126 ret = vmwdt_keepalive(); 130 ret = vmwdt_keepalive();
127 if (ret) 131 if (ret)
128 clear_bit(0, &vmwdt_is_open); 132 clear_bit(0, &vmwdt_is_open);
133 unlock_kernel();
129 return ret ? ret : nonseekable_open(i, f); 134 return ret ? ret : nonseekable_open(i, f);
130} 135}
131 136