android_kernel_motorola_sm6375/drivers/acpi
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Amir Mohammad Jahangirzad 6beaa602f6 ACPI: debug: fix signedness issues in read/write helpers
commit 496f9372eae14775e0524e83e952814691fe850a upstream.

In the ACPI debugger interface, the helper functions for read and write
operations use "int" as the length parameter data type. When a large
"size_t count" is passed from the file operations, this cast to "int"
results in truncation and a negative value due to signed integer
representation.

Logically, this negative number propagates to the min() calculation,
where it is selected over the positive buffer space value, leading to
unexpected behavior. Subsequently, when this negative value is used in
copy_to_user() or copy_from_user(), it is interpreted as a large positive
value due to the unsigned nature of the size parameter in these functions,
causing the copy operations to attempt handling sizes far beyond the
intended buffer limits.

Address the issue by:
 - Changing the length parameters in acpi_aml_read_user() and
   acpi_aml_write_user() from "int" to "size_t", aligning with the
   expected unsigned size semantics.
 - Updating return types and local variables in acpi_aml_read() and
   acpi_aml_write() to "ssize_t" for consistency with kernel file
   operation conventions.
 - Using "size_t" for the "n" variable to ensure calculations remain
   unsigned.
 - Using min_t() for circ_count_to_end() and circ_space_to_end() to
   ensure type-safe comparisons and prevent integer overflow.

Signed-off-by: Amir Mohammad Jahangirzad <[email protected]>
Link: https://patch.msgid.link/[email protected]
[ rjw: Changelog tweaks, local variable definitions ordering adjustments ]
Fixes: 8cfb0cdf07 ("ACPI / debugger: Add IO interface to access debugger functionalities")
Cc: 4.5+ <[email protected]> # 4.5+
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2025-10-29 13:59:52 +01:00
..
acpica ACPICA: Refuse to evaluate a method if arguments are missing 2025-07-17 18:24:58 +02:00
apei ACPI: APEI: GHES: add TAINT_MACHINE_CHECK on GHES panic path 2025-08-28 16:21:25 +02:00
arm64 acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block() 2024-12-14 19:44:22 +01:00
dptf
hmat
nfit ACPI: NFIT: fix a potential deadlock during NFIT teardown 2023-03-03 11:41:47 +01:00
pmic ACPI: PMIC: Remove unneeded check in tps68470_pmic_opregion_probe() 2024-11-08 16:20:26 +01:00
x86
ac.c
acpi_adxl.c
acpi_amba.c
acpi_apd.c
acpi_cmos_rtc.c
acpi_configfs.c
acpi_dbg.c ACPI: debug: fix signedness issues in read/write helpers 2025-10-29 13:59:52 +01:00
acpi_extlog.c ACPI: extlog: fix NULL pointer dereference check 2024-02-23 08:24:54 +01:00
acpi_ipmi.c
acpi_lpat.c
acpi_lpit.c ACPI: LPIT: Avoid u32 multiplication overflow 2024-01-25 14:34:22 -08:00
acpi_lpss.c
acpi_memhotplug.c
acpi_pad.c ACPI: PAD: fix crash in exit_round_robin() 2025-07-17 18:25:00 +02:00
acpi_platform.c
acpi_pnp.c
acpi_processor.c ACPI: processor: fix acpi_object initialization 2025-08-28 16:21:25 +02:00
acpi_tad.c ACPI: TAD: Add missing sysfs_remove_group() for ACPI_TAD_RT 2025-10-29 13:59:52 +01:00
acpi_video.c ACPI: video: Add quirk for the Colorful X15 AT 23 Laptop 2024-02-23 08:24:54 +01:00
acpi_watchdog.c
battery.c Revert "ACPI: battery: negate current when discharging" 2025-07-17 18:25:03 +02:00
bgrt.c
blacklist.c
bus.c
button.c ACPI: button: Add DMI quirk for Samsung Galaxy Book2 to fix initial lid detection issue 2024-11-08 16:20:51 +01:00
cm_sbs.c
container.c
cppc_acpi.c
custom_method.c
debugfs.c
device_pm.c
device_sysfs.c ACPI: sysfs: validate return type of _STR method 2024-11-08 16:20:34 +01:00
dock.c
ec.c ACPI: EC: Do not release locks during operation region accesses 2024-11-08 16:20:37 +01:00
ec_sys.c
event.c
evged.c
fan.c
glue.c
hed.c ACPI: HED: Always initialize before evged 2025-06-04 14:32:33 +02:00
internal.h
ioapic.c
irq.c ACPI: irq: Fix incorrect return value in acpi_register_gsi() 2023-10-25 11:53:24 +02:00
Kconfig ACPI: HED: Always initialize before evged 2025-06-04 14:32:33 +02:00
Makefile
numa.c
nvs.c
osi.c ACPI: OSI: Stop advertising support for "3.0 _SCP Extensions" 2025-06-27 11:02:45 +01:00
osl.c
pci_irq.c
pci_link.c
pci_mcfg.c
pci_root.c
pci_slot.c
power.c
pptt.c ACPI: PPTT: Fix processor subtable walk 2025-06-04 14:32:29 +02:00
proc.c
processor_core.c
processor_driver.c
processor_idle.c ACPI: processor: idle: Fix memory leak when register cpuidle device failed 2025-10-29 13:59:46 +01:00
processor_pdc.c
processor_perflib.c ACPI: processor: perflib: Move problematic pr->performance check 2025-08-28 16:21:24 +02:00
processor_thermal.c
processor_throttling.c
property.c acpi: property: Let args be NULL in __acpi_node_get_property_reference 2024-01-25 14:34:31 -08:00
reboot.c
resource.c ACPI: resource: Skip IRQ override on ASUS Vivobook 14 X1404VAP 2025-04-10 14:29:43 +02:00
sbs.c ACPI: SBS: manage alarm sysfs attribute through psy core 2024-08-19 05:33:47 +02:00
sbshc.c
sbshc.h
scan.c ACPI: scan: Fix device check notification handling 2024-03-26 18:22:16 -04:00
sleep.c Revert "ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default" 2024-04-13 12:51:38 +02:00
sleep.h
spcr.c
sysfs.c
tables.c
thermal.c ACPI: thermal: drop an always true check 2023-06-09 10:29:01 +02:00
utils.c
video_detect.c ACPI: video: Add backlight=native DMI quirk for Lenovo Ideapad Z470 2023-09-23 11:00:03 +02:00
wakeup.c