diff options
author | dissent1 <be.dissent+github@gmail.com> | 2016-11-05 16:15:33 +0300 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2016-12-01 15:47:43 +0100 |
commit | fef6a96d9e9e001a28b6a673c56ed79029457b5d (patch) | |
tree | 808f89926a7a7a2b3b29564e2070592ef983d948 /target/linux/ipq806x/patches-4.4/019-2-nvmem-core-fix-error-path-in-nvmem_add_cells.patch | |
parent | 2b71f958b1d2022bd0c4dcaa458f5ba1b955f934 (diff) | |
download | upstream-fef6a96d9e9e001a28b6a673c56ed79029457b5d.tar.gz upstream-fef6a96d9e9e001a28b6a673c56ed79029457b5d.tar.bz2 upstream-fef6a96d9e9e001a28b6a673c56ed79029457b5d.zip |
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-2-nvmem-core-fix-error-path-in-nvmem_add_cells.patch')
-rw-r--r-- | target/linux/ipq806x/patches-4.4/019-2-nvmem-core-fix-error-path-in-nvmem_add_cells.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/target/linux/ipq806x/patches-4.4/019-2-nvmem-core-fix-error-path-in-nvmem_add_cells.patch b/target/linux/ipq806x/patches-4.4/019-2-nvmem-core-fix-error-path-in-nvmem_add_cells.patch new file mode 100644 index 0000000000..1f9473bafd --- /dev/null +++ b/target/linux/ipq806x/patches-4.4/019-2-nvmem-core-fix-error-path-in-nvmem_add_cells.patch @@ -0,0 +1,34 @@ +From dfdf141429f0895b63c882facc42c86f225033cb Mon Sep 17 00:00:00 2001 +From: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Date: Mon, 8 Feb 2016 22:04:29 +0100 +Subject: nvmem: core: fix error path in nvmem_add_cells() + +The current code fails to nvmem_cell_drop(cells[0]) - even worse, if +the loop above fails already at i==0, we'll enter an essentially +infinite loop doing nvmem_cell_drop on cells[-1], cells[-2], ... which +is unlikely to end well. + +Also, we're not freeing the temporary backing array cells on the error +path. + +Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/nvmem/core.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -294,9 +294,11 @@ static int nvmem_add_cells(struct nvmem_ + + return 0; + err: +- while (--i) ++ while (i--) + nvmem_cell_drop(cells[i]); + ++ kfree(cells); ++ + return rval; + } + |