aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmur.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/vmur.c')
-rw-r--r--drivers/s390/char/vmur.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 83ae9a852f00..61549987ed70 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>
@@ -668,7 +669,7 @@ static int ur_open(struct inode *inode, struct file *file)
668 669
669 if (accmode == O_RDWR) 670 if (accmode == O_RDWR)
670 return -EACCES; 671 return -EACCES;
671 672 lock_kernel();
672 /* 673 /*
673 * We treat the minor number as the devno of the ur device 674 * We treat the minor number as the devno of the ur device
674 * to find in the driver tree. 675 * to find in the driver tree.
@@ -676,8 +677,10 @@ static int ur_open(struct inode *inode, struct file *file)
676 devno = MINOR(file->f_dentry->d_inode->i_rdev); 677 devno = MINOR(file->f_dentry->d_inode->i_rdev);
677 678
678 urd = urdev_get_from_devno(devno); 679 urd = urdev_get_from_devno(devno);
679 if (!urd) 680 if (!urd) {
680 return -ENXIO; 681 rc = -ENXIO;
682 goto out;
683 }
681 684
682 spin_lock(&urd->open_lock); 685 spin_lock(&urd->open_lock);
683 while (urd->open_flag) { 686 while (urd->open_flag) {
@@ -720,6 +723,7 @@ static int ur_open(struct inode *inode, struct file *file)
720 goto fail_urfile_free; 723 goto fail_urfile_free;
721 urf->file_reclen = rc; 724 urf->file_reclen = rc;
722 file->private_data = urf; 725 file->private_data = urf;
726 unlock_kernel();
723 return 0; 727 return 0;
724 728
725fail_urfile_free: 729fail_urfile_free:
@@ -730,6 +734,8 @@ fail_unlock:
730 spin_unlock(&urd->open_lock); 734 spin_unlock(&urd->open_lock);
731fail_put: 735fail_put:
732 urdev_put(urd); 736 urdev_put(urd);
737out:
738 unlock_kernel();
733 return rc; 739 return rc;
734} 740}
735 741