Skip to content

Commit

Permalink
watchdog: f71808e_wdt: Fix magic close handling
Browse files Browse the repository at this point in the history
[ Upstream commit 7bd3e7b ]

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 <igor.pylypiv@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Igor Pylypiv authored and Greg Kroah-Hartman committed May 30, 2018
1 parent 7361dfb commit 089e299
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/watchdog/f71808e_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ static ssize_t watchdog_write(struct file *file, const char __user *buf,
char c;
if (get_user(c, buf + i))
return -EFAULT;
expect_close = (c == 'V');
if (c == 'V')
expect_close = true;
}

/* Properly order writes across fork()ed processes */
Expand Down

0 comments on commit 089e299

Please sign in to comment.