aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/ubd_kern.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index da992a3ad6b7..1bcd208c459f 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -33,6 +33,7 @@
33#include "linux/mm.h" 33#include "linux/mm.h"
34#include "linux/slab.h" 34#include "linux/slab.h"
35#include "linux/vmalloc.h" 35#include "linux/vmalloc.h"
36#include "linux/smp_lock.h"
36#include "linux/blkpg.h" 37#include "linux/blkpg.h"
37#include "linux/genhd.h" 38#include "linux/genhd.h"
38#include "linux/spinlock.h" 39#include "linux/spinlock.h"
@@ -1098,6 +1099,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1098 struct ubd *ubd_dev = disk->private_data; 1099 struct ubd *ubd_dev = disk->private_data;
1099 int err = 0; 1100 int err = 0;
1100 1101
1102 lock_kernel();
1101 if(ubd_dev->count == 0){ 1103 if(ubd_dev->count == 0){
1102 err = ubd_open_dev(ubd_dev); 1104 err = ubd_open_dev(ubd_dev);
1103 if(err){ 1105 if(err){
@@ -1115,7 +1117,8 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1115 if(--ubd_dev->count == 0) ubd_close_dev(ubd_dev); 1117 if(--ubd_dev->count == 0) ubd_close_dev(ubd_dev);
1116 err = -EROFS; 1118 err = -EROFS;
1117 }*/ 1119 }*/
1118 out: 1120out:
1121 unlock_kernel();
1119 return err; 1122 return err;
1120} 1123}
1121 1124
@@ -1123,8 +1126,10 @@ static int ubd_release(struct gendisk *disk, fmode_t mode)
1123{ 1126{
1124 struct ubd *ubd_dev = disk->private_data; 1127 struct ubd *ubd_dev = disk->private_data;
1125 1128
1129 lock_kernel();
1126 if(--ubd_dev->count == 0) 1130 if(--ubd_dev->count == 0)
1127 ubd_close_dev(ubd_dev); 1131 ubd_close_dev(ubd_dev);
1132 unlock_kernel();
1128 return 0; 1133 return 0;
1129} 1134}
1130 1135