aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-3.2/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2012-01-13 14:55:07 +0000
committerJonas Gorski <jogo@openwrt.org>2012-01-13 14:55:07 +0000
commit1bc0abb058e09fd7214507dd4a095658a4b8d122 (patch)
tree82c35f5f43253e1a2ff9c2ff1318fac1c86e57df /target/linux/generic/patches-3.2/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch
parent50d4c0e31a6706f28b3c69cd24bcf0c205223e16 (diff)
downloadupstream-1bc0abb058e09fd7214507dd4a095658a4b8d122.tar.gz
upstream-1bc0abb058e09fd7214507dd4a095658a4b8d122.tar.bz2
upstream-1bc0abb058e09fd7214507dd4a095658a4b8d122.zip
kernel: add support for linux 3.2.1
SVN-Revision: 29730
Diffstat (limited to 'target/linux/generic/patches-3.2/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch')
-rw-r--r--target/linux/generic/patches-3.2/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.2/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch b/target/linux/generic/patches-3.2/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch
new file mode 100644
index 0000000000..fa261ce648
--- /dev/null
+++ b/target/linux/generic/patches-3.2/993-mpcore_wdt_fix_wdioc_setoptions_handling.patch
@@ -0,0 +1,29 @@
+According to the include/linux/watchdog.h WDIOC_SETOPTIONS is
+classified as 'read from device' ioctl call:
+ #define WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int)
+
+However, the driver 'mpcore_wdt' performs 'copy_from_user' only if
+_IOC_WRITE is set, thus the local variable 'uarg' which is used in
+WDIOC_SETOPTIONS handling remains uninitialized.
+
+The proper way to fix this is to bind WDIOC_SETOPTIONS to _IOW,
+but this will break compatibility.
+So adding additional condition for performing 'copy_from_user'.
+
+Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
+---
+ drivers/watchdog/mpcore_wdt.c | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+--- a/drivers/watchdog/mpcore_wdt.c
++++ b/drivers/watchdog/mpcore_wdt.c
+@@ -233,7 +233,8 @@ static long mpcore_wdt_ioctl(struct file
+ if (_IOC_DIR(cmd) && _IOC_SIZE(cmd) > sizeof(uarg))
+ return -ENOTTY;
+
+- if (_IOC_DIR(cmd) & _IOC_WRITE) {
++ if ((_IOC_DIR(cmd) & _IOC_WRITE)
++ || cmd == WDIOC_SETOPTIONS) {
+ ret = copy_from_user(&uarg, (void __user *)arg, _IOC_SIZE(cmd));
+ if (ret)
+ return -EFAULT;