Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'iommu-fixes-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux

Pull iommu fixes from Joerg Roedel:

- AMD-Vi: Fix potential stack buffer overflow via command line

- NVidia-Tegra: Fix endianess sparse warning

- ARM-SMMU: Fix ATS-masters reference count issue

- Virtio-IOMMU: Fix race condition on instance lookup

- RISC-V IOMMU: Fix potential NULL-ptr dereference in
riscv_iommu_iova_to_phys()

* tag 'iommu-fixes-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux:
iommu/riscv: prevent NULL deref in iova_to_phys
iommu/virtio: Make instance lookup robust
iommu/arm-smmu-v3: Fix smmu_domain->nr_ats_masters decrement
iommu/tegra241-cmdqv: Fix missing cpu_to_le64 at lvcmdq_err_map
iommu/amd: Avoid stack buffer overflow from kernel cmdline

+18 -13
+2 -2
drivers/iommu/amd/init.c
··· 3638 3638 { 3639 3639 u32 seg = 0, bus, dev, fn; 3640 3640 char *hid, *uid, *p, *addr; 3641 - char acpiid[ACPIID_LEN] = {0}; 3641 + char acpiid[ACPIID_LEN + 1] = { }; /* size with NULL terminator */ 3642 3642 int i; 3643 3643 3644 3644 addr = strchr(str, '@'); ··· 3664 3664 /* We have the '@', make it the terminator to get just the acpiid */ 3665 3665 *addr++ = 0; 3666 3666 3667 - if (strlen(str) > ACPIID_LEN + 1) 3667 + if (strlen(str) > ACPIID_LEN) 3668 3668 goto not_found; 3669 3669 3670 3670 if (sscanf(str, "=%s", acpiid) != 1)
+1 -1
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
··· 2997 2997 /* ATS is being switched off, invalidate the entire ATC */ 2998 2998 arm_smmu_atc_inv_master(master, IOMMU_NO_PASID); 2999 2999 } 3000 - master->ats_enabled = state->ats_enabled; 3001 3000 3002 3001 arm_smmu_remove_master_domain(master, state->old_domain, state->ssid); 3002 + master->ats_enabled = state->ats_enabled; 3003 3003 } 3004 3004 3005 3005 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
+5 -3
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
··· 301 301 struct iommu_vevent_tegra241_cmdqv vevent_data; 302 302 int i; 303 303 304 - for (i = 0; i < LVCMDQ_ERR_MAP_NUM_64; i++) 305 - vevent_data.lvcmdq_err_map[i] = 306 - readq_relaxed(REG_VINTF(vintf, LVCMDQ_ERR_MAP_64(i))); 304 + for (i = 0; i < LVCMDQ_ERR_MAP_NUM_64; i++) { 305 + u64 err = readq_relaxed(REG_VINTF(vintf, LVCMDQ_ERR_MAP_64(i))); 306 + 307 + vevent_data.lvcmdq_err_map[i] = cpu_to_le64(err); 308 + } 307 309 308 310 iommufd_viommu_report_event(viommu, IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV, 309 311 &vevent_data, sizeof(vevent_data));
+1 -1
drivers/iommu/riscv/iommu.c
··· 1283 1283 unsigned long *ptr; 1284 1284 1285 1285 ptr = riscv_iommu_pte_fetch(domain, iova, &pte_size); 1286 - if (_io_pte_none(*ptr) || !_io_pte_present(*ptr)) 1286 + if (!ptr) 1287 1287 return 0; 1288 1288 1289 1289 return pfn_to_phys(__page_val_to_pfn(*ptr)) | (iova & (pte_size - 1));
+9 -6
drivers/iommu/virtio-iommu.c
··· 998 998 iommu_dma_get_resv_regions(dev, head); 999 999 } 1000 1000 1001 - static const struct iommu_ops viommu_ops; 1002 - static struct virtio_driver virtio_iommu_drv; 1001 + static const struct bus_type *virtio_bus_type; 1003 1002 1004 1003 static int viommu_match_node(struct device *dev, const void *data) 1005 1004 { ··· 1007 1008 1008 1009 static struct viommu_dev *viommu_get_by_fwnode(struct fwnode_handle *fwnode) 1009 1010 { 1010 - struct device *dev = driver_find_device(&virtio_iommu_drv.driver, NULL, 1011 - fwnode, viommu_match_node); 1011 + struct device *dev = bus_find_device(virtio_bus_type, NULL, fwnode, 1012 + viommu_match_node); 1013 + 1012 1014 put_device(dev); 1013 1015 1014 1016 return dev ? dev_to_virtio(dev)->priv : NULL; ··· 1160 1160 if (!viommu) 1161 1161 return -ENOMEM; 1162 1162 1163 + /* Borrow this for easy lookups later */ 1164 + virtio_bus_type = dev->bus; 1165 + 1163 1166 spin_lock_init(&viommu->request_lock); 1164 1167 ida_init(&viommu->domain_ids); 1165 1168 viommu->dev = dev; ··· 1232 1229 if (ret) 1233 1230 goto err_free_vqs; 1234 1231 1235 - iommu_device_register(&viommu->iommu, &viommu_ops, parent_dev); 1236 - 1237 1232 vdev->priv = viommu; 1233 + 1234 + iommu_device_register(&viommu->iommu, &viommu_ops, parent_dev); 1238 1235 1239 1236 dev_info(dev, "input address: %u bits\n", 1240 1237 order_base_2(viommu->geometry.aperture_end));