projects
/
linux
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8400291
)
ACPI: sysfs: validate return type of _STR method
author
Thomas Weißschuh
<linux@weissschuh.net>
Tue, 9 Jul 2024 20:37:24 +0000
(22:37 +0200)
committer
Rafael J. Wysocki
<rafael.j.wysocki@intel.com>
Fri, 2 Aug 2024 14:44:22 +0000
(16:44 +0200)
Only buffer objects are valid return values of _STR.
If something else is returned description_show() will access invalid
memory.
Fixes:
d1efe3c324ea
("ACPI: Add new sysfs interface to export device description")
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link:
https://patch.msgid.link/20240709-acpi-sysfs-groups-v2-1-058ab0667fa8@weissschuh.net
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/device_sysfs.c
patch
|
blob
|
history
diff --git
a/drivers/acpi/device_sysfs.c
b/drivers/acpi/device_sysfs.c
index 23373faa35ecd6a48e13090d2be3ca9a4a6e7c62..95a19e3569c83fc6f5caf350925811bdaac95cce 100644
(file)
--- a/
drivers/acpi/device_sysfs.c
+++ b/
drivers/acpi/device_sysfs.c
@@
-540,8
+540,9
@@
int acpi_device_setup_files(struct acpi_device *dev)
* If device has _STR, 'description' file is created
*/
if (acpi_has_method(dev->handle, "_STR")) {
- status = acpi_evaluate_object(dev->handle, "_STR",
- NULL, &buffer);
+ status = acpi_evaluate_object_typed(dev->handle, "_STR",
+ NULL, &buffer,
+ ACPI_TYPE_BUFFER);
if (ACPI_FAILURE(status))
buffer.pointer = NULL;
dev->pnp.str_obj = buffer.pointer;