Skip to content

Commit 7bd3e7b

Browse files
ipylypivWim Van Sebroeck
authored andcommitted
watchdog: f71808e_wdt: Fix magic close handling
Watchdog close is "expected" when any byte is 'V' not just the last one. Writing "V" to the device fails because the last byte is the end of string. $ echo V > /dev/watchdog f71808e_wdt: Unexpected close, not stopping watchdog! Signed-off-by: Igor Pylypiv <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent a17f4f0 commit 7bd3e7b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/watchdog/f71808e_wdt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,8 @@ static ssize_t watchdog_write(struct file *file, const char __user *buf,
566566
char c;
567567
if (get_user(c, buf + i))
568568
return -EFAULT;
569-
expect_close = (c == 'V');
569+
if (c == 'V')
570+
expect_close = true;
570571
}
571572

572573
/* Properly order writes across fork()ed processes */

0 commit comments

Comments
 (0)