Skip to contentSkip to conversation

iommu: avoid format string leaks into iommu_device_create

PATCH Applied Kees Cook 2 participants 2 messages Jul 24, 2015 – Aug 3, 2015 IOMMU

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 iommu: avoid format string leaks into iommu_device_create

This makes sure it won't be possible to accidentally leak format strings into iommu device names. Current name allocations are safe, but this makes the "%s" explicit.

---
 drivers/iommu/dmar.c        | 2 +-
 drivers/iommu/intel-iommu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/dmar.c +1 -1
index c9db04d4ef39..8757f8dfc4e5 100644
@@ -1068,7 +1068,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 	if (intel_iommu_enabled)
 		iommu->iommu_dev = iommu_device_create(NULL, iommu,
 						       intel_iommu_groups,
-						       iommu->name);
+						       "%s", iommu->name);
 
 	return 0;
 
drivers/iommu/intel-iommu.c +1 -1
index 0649b94f5958..0be23c589d3b 100644
@@ -4533,7 +4533,7 @@ int __init intel_iommu_init(void)
 	for_each_active_iommu(iommu, drhd)
 		iommu->iommu_dev = iommu_device_create(NULL, iommu,
 						       intel_iommu_groups,
-						       iommu->name);
+						       "%s", iommu->name);
 
 	bus_set_iommu(&pci_bus_type, &intel_iommu_ops);
 	bus_register_notifier(&pci_bus_type, &device_nb);
Signature · 6 lines
1.9.1


-- 
Kees Cook
Chrome OS Security
maintainer Applied
#1 lore raw
Quoted 9 lines · Kees Cook

This makes sure it won't be possible to accidentally leak format strings into iommu device names. Current name allocations are safe, but this makes the "%s" explicit.

---
 drivers/iommu/dmar.c        | 2 +-
 drivers/iommu/intel-iommu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.