summaryrefslogtreecommitdiff
path: root/drivers/acpi/custom_method.c
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2021-05-31 03:09:03 +0300
committerMichael Bestas <mkbestas@lineageos.org>2021-05-31 03:09:03 +0300
commit0ce166e3c4e576ae072d950006a937931df8ca3c (patch)
tree87428d6651cc3cd42c586331c67590f3a9e2c578 /drivers/acpi/custom_method.c
parenta4940e8fb458a45644126d132c2d5b74719df8df (diff)
parent3628cdd31199df6519ecad709f5cc8be9401f93e (diff)
Merge branch 'android-4.4-p' of https://android.googlesource.com/kernel/common into lineage-18.1-caf-msm8998
This brings LA.UM.9.2.r1-03300-SDMxx0.0 up to date with https://android.googlesource.com/kernel/common/ android-4.4-p at commit: 3628cdd31199d Merge 4.4.270 into android-4.4-p Conflicts: drivers/mmc/core/core.c drivers/usb/core/hub.c kernel/trace/trace.c Change-Id: I6b81471122341f9769ce9c65cbd0fedd5e908b38
Diffstat (limited to 'drivers/acpi/custom_method.c')
-rw-r--r--drivers/acpi/custom_method.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
index 435bd0ffc8c0..ea4c7c93a920 100644
--- a/drivers/acpi/custom_method.c
+++ b/drivers/acpi/custom_method.c
@@ -37,6 +37,8 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
sizeof(struct acpi_table_header)))
return -EFAULT;
uncopied_bytes = max_size = table.length;
+ /* make sure the buf is not allocated */
+ kfree(buf);
buf = kzalloc(max_size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
@@ -50,6 +52,7 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
(*ppos + count < count) ||
(count > uncopied_bytes)) {
kfree(buf);
+ buf = NULL;
return -EINVAL;
}
@@ -71,7 +74,6 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
}
- kfree(buf);
return count;
}