iommu/vt-d: Avoid format string leaks into iommu_device_create
authorKees Cook <keescook@chromium.org>
Fri, 24 Jul 2015 23:27:57 +0000 (16:27 -0700)
committerJoerg Roedel <jroedel@suse.de>
Mon, 3 Aug 2015 14:15:47 +0000 (16:15 +0200)
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.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/dmar.c
drivers/iommu/intel-iommu.c

index c9db04d4ef39ae36553279859b6ca0f1c7972db1..8757f8dfc4e57afee580fc68d76b88658467dea5 100644 (file)
@@ -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;
 
index 0649b94f59584ca5b885cd0ecad595a84af0d89d..0be23c589d3b31263f3685b80cfeb933ac414a85 100644 (file)
@@ -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);