aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmwatchdog.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/vmwatchdog.c')
-rw-r--r--drivers/s390/char/vmwatchdog.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c
index 19f8389291b6..ee80e936d514 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>
@@ -131,11 +132,15 @@ static int __init vmwdt_probe(void)
131static int vmwdt_open(struct inode *i, struct file *f) 132static int vmwdt_open(struct inode *i, struct file *f)
132{ 133{
133 int ret; 134 int ret;
134 if (test_and_set_bit(0, &vmwdt_is_open)) 135 lock_kernel();
136 if (test_and_set_bit(0, &vmwdt_is_open)) {
137 unlock_kernel();
135 return -EBUSY; 138 return -EBUSY;
139 }
136 ret = vmwdt_keepalive(); 140 ret = vmwdt_keepalive();
137 if (ret) 141 if (ret)
138 clear_bit(0, &vmwdt_is_open); 142 clear_bit(0, &vmwdt_is_open);
143 unlock_kernel();
139 return ret ? ret : nonseekable_open(i, f); 144 return ret ? ret : nonseekable_open(i, f);
140} 145}
141 146