android_kernel_samsung_msm8976/drivers/acpi
Takashi Iwai 847d1c16ab ACPI: APEI / ERST: Fix missing error handling in erst_reader()
commit bb82e0b4a7e96494f0c1004ce50cec3d7b5fb3d1 upstream.

The commit f6f8285132 ("pstore: pass allocated memory region back to
caller") changed the check of the return value from erst_read() in
erst_reader() in the following way:

        if (len == -ENOENT)
                goto skip;
-       else if (len < 0) {
-               rc = -1;
+       else if (len < sizeof(*rcd)) {
+               rc = -EIO;
                goto out;

This introduced another bug: since the comparison with sizeof() is
cast to unsigned, a negative len value doesn't hit any longer.
As a result, when an error is returned from erst_read(), the code
falls through, and it may eventually lead to some weird thing like
memory corruption.

This patch adds the negative error value check more explicitly for
addressing the issue.

Fixes: f6f8285132 (pstore: pass allocated memory region back to caller)
Tested-by: Jerry Tang <jtang@suse.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:46:19 +02:00
..
acpica ACPICA: Dispatcher: Update thread ID for recursive method calls 2016-06-07 10:42:53 +02:00
apei ACPI: APEI / ERST: Fix missing error handling in erst_reader() 2019-07-27 21:46:19 +02:00
Kconfig
Makefile
ac.c
acpi_cmos_rtc.c
acpi_i2c.c
acpi_ipmi.c
acpi_lpss.c
acpi_memhotplug.c
acpi_pad.c
acpi_platform.c
battery.c ACPI / battery: Retry to get battery information if failed during probing 2014-07-17 15:58:04 -07:00
bgrt.c
blacklist.c ACPI / blacklist: Add dmi_enable_osi_linux quirk for Asus EEE PC 1015PX 2014-06-07 13:25:39 -07:00
bus.c ACPI: Fix conflict between customized DSDT and DSDT local copy 2014-06-30 20:09:44 -07:00
button.c
cm_sbs.c
container.c
custom_method.c
debugfs.c
device_pm.c
dock.c
ec.c ACPI / EC: Ensure lock is acquired before accessing ec struct members 2013-11-29 11:11:43 -08:00
ec_sys.c
event.c
fan.c
glue.c
hed.c
internal.h
numa.c
nvs.c
osl.c ACPI / init: Fix the ordering of acpi_reserve_resources() 2015-06-05 23:20:00 -07:00
pci_irq.c ACPI / PCI: Fix memory leak in acpi_pci_irq_enable() 2014-03-06 21:30:09 -08:00
pci_link.c
pci_root.c ACPI / hotplug: Fix conflicted PCI bridge notify handlers 2013-12-04 10:57:04 -08:00
pci_slot.c
power.c
proc.c
processor_core.c
processor_driver.c
processor_idle.c cpuidle: ACPI: do not overwrite name and description of C0 2015-04-19 10:10:49 +02:00
processor_perflib.c
processor_thermal.c
processor_throttling.c ACPI / processor: Rework processor throttling with work_on_cpu() 2014-03-06 21:30:09 -08:00
reboot.c
resource.c ACPI / resources: only reject zero length resources based at address zero 2014-07-17 15:58:01 -07:00
sbs.c
sbshc.c
sbshc.h
scan.c ACPI: Run fixed event device notifications in process context 2014-09-17 09:03:59 -07:00
sleep.c ACPI / sleep: Add extra checks for HW Reduced ACPI mode sleep states 2014-03-23 21:38:17 -07:00
sleep.h
sysfs.c
tables.c
thermal.c
utils.c
video.c ACPI / video: Load the module even if ACPI is disabled 2015-03-18 13:22:35 +01:00
video_detect.c
wakeup.c