summaryrefslogtreecommitdiff
path: root/target/linux/ipq806x/patches-4.4/019-1-nvmem-core-return-error-for-non-word-aligned-access.patch
diff options
context:
space:
mode:
authordissent1 <be.dissent+github@gmail.com>2016-11-05 16:15:33 +0300
committerJohn Crispin <john@phrozen.org>2016-12-01 15:47:43 +0100
commitfef6a96d9e9e001a28b6a673c56ed79029457b5d (patch)
tree808f89926a7a7a2b3b29564e2070592ef983d948 /target/linux/ipq806x/patches-4.4/019-1-nvmem-core-return-error-for-non-word-aligned-access.patch
parent2b71f958b1d2022bd0c4dcaa458f5ba1b955f934 (diff)
downloadmtk-20170518-fef6a96d9e9e001a28b6a673c56ed79029457b5d.zip
mtk-20170518-fef6a96d9e9e001a28b6a673c56ed79029457b5d.tar.gz
mtk-20170518-fef6a96d9e9e001a28b6a673c56ed79029457b5d.tar.bz2
ipq806x: add thermal sensor driver
Allows to check cpu temperature. Huge thanks to @hnyman for valuable assistance! Signed-off-by: Pavel Kubelun <be.dissent@gmail.com>
Diffstat (limited to 'target/linux/ipq806x/patches-4.4/019-1-nvmem-core-return-error-for-non-word-aligned-access.patch')
-rw-r--r--target/linux/ipq806x/patches-4.4/019-1-nvmem-core-return-error-for-non-word-aligned-access.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/ipq806x/patches-4.4/019-1-nvmem-core-return-error-for-non-word-aligned-access.patch b/target/linux/ipq806x/patches-4.4/019-1-nvmem-core-return-error-for-non-word-aligned-access.patch
new file mode 100644
index 0000000..13415f5
--- /dev/null
+++ b/target/linux/ipq806x/patches-4.4/019-1-nvmem-core-return-error-for-non-word-aligned-access.patch
@@ -0,0 +1,42 @@
+From 313a72ff983cc2e00ac4dcb791d40ebf2f9d5718 Mon Sep 17 00:00:00 2001
+From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+Date: Tue, 17 Nov 2015 09:12:41 +0000
+Subject: nvmem: core: return error for non word aligned access
+
+nvmem providers have restrictions on register strides, so return error
+when users attempt to read/write buffers with sizes which are less
+than word size.
+
+Without this patch the userspace would continue to try as it does not
+get any error from the nvmem core, resulting in a hang or endless loop
+in userspace.
+
+Reported-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
+Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/nvmem/core.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/nvmem/core.c
++++ b/drivers/nvmem/core.c
+@@ -70,6 +70,9 @@ static ssize_t bin_attr_nvmem_read(struc
+ if (pos >= nvmem->size)
+ return 0;
+
++ if (count < nvmem->word_size)
++ return -EINVAL;
++
+ if (pos + count > nvmem->size)
+ count = nvmem->size - pos;
+
+@@ -95,6 +98,9 @@ static ssize_t bin_attr_nvmem_write(stru
+ if (pos >= nvmem->size)
+ return 0;
+
++ if (count < nvmem->word_size)
++ return -EINVAL;
++
+ if (pos + count > nvmem->size)
+ count = nvmem->size - pos;
+