提交 7bd3e7b7 编写于 作者: I Igor Pylypiv 提交者: Wim Van Sebroeck

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: NIgor Pylypiv <igor.pylypiv@gmail.com>
Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NWim Van Sebroeck <wim@iguana.be>
上级 a17f4f03
...@@ -566,7 +566,8 @@ static ssize_t watchdog_write(struct file *file, const char __user *buf, ...@@ -566,7 +566,8 @@ static ssize_t watchdog_write(struct file *file, const char __user *buf,
char c; char c;
if (get_user(c, buf + i)) if (get_user(c, buf + i))
return -EFAULT; return -EFAULT;
expect_close = (c == 'V'); if (c == 'V')
expect_close = true;
} }
/* Properly order writes across fork()ed processes */ /* Properly order writes across fork()ed processes */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册