Skip to content

Commit 4bb1e7d

Browse files
t-8chrafaeljw
authored andcommitted
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: d1efe3c ("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]>
1 parent 8400291 commit 4bb1e7d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/acpi/device_sysfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,9 @@ int acpi_device_setup_files(struct acpi_device *dev)
540540
* If device has _STR, 'description' file is created
541541
*/
542542
if (acpi_has_method(dev->handle, "_STR")) {
543-
status = acpi_evaluate_object(dev->handle, "_STR",
544-
NULL, &buffer);
543+
status = acpi_evaluate_object_typed(dev->handle, "_STR",
544+
NULL, &buffer,
545+
ACPI_TYPE_BUFFER);
545546
if (ACPI_FAILURE(status))
546547
buffer.pointer = NULL;
547548
dev->pnp.str_obj = buffer.pointer;

0 commit comments

Comments
 (0)