diff options
author | Thomas Weißschuh <[email protected]> | 2024-07-09 22:37:24 +0200 |
---|---|---|
committer | Rafael J. Wysocki <[email protected]> | 2024-08-02 16:44:22 +0200 |
commit | 4bb1e7d027413835b086aed35bc3f0713bc0f72b (patch) | |
tree | ecaab6e92dd5b05c106bb2bad7bda5e2934df5e9 | |
parent | 8400291e289ee6b2bf9779ff1c83a291501f017b (diff) |
ACPI: sysfs: validate return type of _STR method
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 <[email protected]>
Signed-off-by: Thomas Weißschuh <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Rafael J. Wysocki <[email protected]>
-rw-r--r-- | drivers/acpi/device_sysfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c index 23373faa35ec..95a19e3569c8 100644 --- 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; |