mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
ACPI: sysfs: validate return type of _STR method
commit 4bb1e7d027413835b086aed35bc3f0713bc0f72b upstream.
Only buffer objects are valid return values of _STR.
If something else is returned description_show() will access invalid
memory.
Fixes: d1efe3c324 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ca6ed002a9
commit
5c8d007c14
@@ -544,8 +544,9 @@ int acpi_device_setup_files(struct acpi_device *dev)
|
|||||||
* If device has _STR, 'description' file is created
|
* If device has _STR, 'description' file is created
|
||||||
*/
|
*/
|
||||||
if (acpi_has_method(dev->handle, "_STR")) {
|
if (acpi_has_method(dev->handle, "_STR")) {
|
||||||
status = acpi_evaluate_object(dev->handle, "_STR",
|
status = acpi_evaluate_object_typed(dev->handle, "_STR",
|
||||||
NULL, &buffer);
|
NULL, &buffer,
|
||||||
|
ACPI_TYPE_BUFFER);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
buffer.pointer = NULL;
|
buffer.pointer = NULL;
|
||||||
dev->pnp.str_obj = buffer.pointer;
|
dev->pnp.str_obj = buffer.pointer;
|
||||||
|
|||||||
Reference in New Issue
Block a user