aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0774-w1_therm-Free-the-correct-variable.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2021-02-18 18:04:33 +0100
committerÁlvaro Fernández Rojas <noltari@gmail.com>2021-02-19 07:17:21 +0100
commit62b7f5931c54e96fca56dd8761b0e466d355c881 (patch)
tree1258b392752379833a075df006c2f6d7ac4be51d /target/linux/bcm27xx/patches-5.4/950-0774-w1_therm-Free-the-correct-variable.patch
parent76d1168d0d4b9d76e2ad78c0fc6b255561deb284 (diff)
downloadupstream-62b7f5931c54e96fca56dd8761b0e466d355c881.tar.gz
upstream-62b7f5931c54e96fca56dd8761b0e466d355c881.tar.bz2
upstream-62b7f5931c54e96fca56dd8761b0e466d355c881.zip
bcm27xx: import latest patches from the RPi foundation
bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G bcm2710: boot tested on RPi 3B v1.2 bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (cherry-picked from commit f07e572f64)
Diffstat (limited to 'target/linux/bcm27xx/patches-5.4/950-0774-w1_therm-Free-the-correct-variable.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.4/950-0774-w1_therm-Free-the-correct-variable.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.4/950-0774-w1_therm-Free-the-correct-variable.patch b/target/linux/bcm27xx/patches-5.4/950-0774-w1_therm-Free-the-correct-variable.patch
new file mode 100644
index 0000000000..fede4120ba
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.4/950-0774-w1_therm-Free-the-correct-variable.patch
@@ -0,0 +1,41 @@
+From 039babe99fda6eb04a77ca29cacf98efd1a5f406 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Wed, 20 May 2020 15:00:19 +0300
+Subject: [PATCH] w1_therm: Free the correct variable
+
+commit e420637b81f78d0fbacf539bdb1b341eba602aea upstream.
+
+The problem is that we change "p_args" to point to the middle of the
+string so when we free it at the end of the function it's not freeing
+the same pointer that we originally allocated.
+
+Fixes: e2c94d6f5720 ("w1_therm: adding alarm sysfs entry")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20200520120019.GA172354@mwanda
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/w1/slaves/w1_therm.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/w1/slaves/w1_therm.c
++++ b/drivers/w1/slaves/w1_therm.c
+@@ -1526,8 +1526,9 @@ static ssize_t alarms_store(struct devic
+ int temp, ret = -EINVAL;
+ char *token = NULL;
+ s8 tl, th, tt; /* 1 byte per value + temp ring order */
+- char *p_args = kmalloc(size, GFP_KERNEL);
++ char *p_args, *orig;
+
++ p_args = orig = kmalloc(size, GFP_KERNEL);
+ /* Safe string copys as buf is const */
+ if (!p_args) {
+ dev_warn(device,
+@@ -1611,7 +1612,7 @@ static ssize_t alarms_store(struct devic
+
+ free_m:
+ /* free allocated memory */
+- kfree(p_args);
++ kfree(orig);
+
+ return size;
+ }