Skip to contentSkip to conversation

acpi: avoid leaking format string into kobject name

PATCH Applied Kees Cook 2 participants 2 messages Jan 7, 2016 – Jan 8, 2016 ACPI

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 acpi: avoid leaking format string into kobject name

The dn->name is expected to be used as a literal, so add the missing "%s".

---
 drivers/acpi/device_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/device_sysfs.c +1 -1
index 707cf6213bc2..b9afb47db7ed 100644
@@ -104,7 +104,7 @@ static void acpi_expose_nondev_subnodes(struct kobject *kobj,
 
 		init_completion(&dn->kobj_done);
 		ret = kobject_init_and_add(&dn->kobj, &acpi_data_node_ktype,
-					   kobj, dn->name);
+					   kobj, "%s", dn->name);
 		if (ret)
 			acpi_handle_err(dn->handle, "Failed to expose (%d)\n", ret);
 		else
Signature · 6 lines
2.6.3


-- 
Kees Cook
Chrome OS & Brillo Security
#1 lore raw
Quoted 4 lines · Kees Cook

The dn->name is expected to be used as a literal, so add the missing "%s".

Applied, thanks!

Quoted 18 lines
---
 drivers/acpi/device_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/device_sysfs.c +1 -1
index 707cf6213bc2..b9afb47db7ed 100644
@@ -104,7 +104,7 @@ static void acpi_expose_nondev_subnodes(struct kobject *kobj,
 
 		init_completion(&dn->kobj_done);
 		ret = kobject_init_and_add(&dn->kobj, &acpi_data_node_ktype,
-					   kobj, dn->name);
+					   kobj, "%s", dn->name);
 		if (ret)
 			acpi_handle_err(dn->handle, "Failed to expose (%d)\n", ret);
 		else
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.