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

iommu/amd: Fix error path in amd_iommu_probe_device()

Currently, the error path of amd_iommu_probe_device() unconditionally
references dev_data, which may not be initialized if an early failure
occurs (like iommu_init_device() fails).

Move the out_err label to ensure the function exits immediately on
failure without accessing potentially uninitialized dev_data.

Fixes: 19e5cc156cb ("iommu/amd: Enable support for up to 2K interrupts per function")
Cc: Rakuram Eswaran <rakuram.e96@gmail.com>
Cc: Jörg Rödel <joro@8bytes.org>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202512191724.meqJENXe-lkp@intel.com/
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

authored by

Vasant Hegde and committed by
Joerg Roedel
3222b6de 0f61b186

+1 -2
+1 -2
drivers/iommu/amd/iommu.c
··· 2450 2450 goto out_err; 2451 2451 } 2452 2452 2453 - out_err: 2454 - 2455 2453 iommu_completion_wait(iommu); 2456 2454 2457 2455 if (FEATURE_NUM_INT_REMAP_SUP_2K(amd_iommu_efr2)) ··· 2460 2462 if (dev_is_pci(dev)) 2461 2463 pci_prepare_ats(to_pci_dev(dev), PAGE_SHIFT); 2462 2464 2465 + out_err: 2463 2466 return iommu_dev; 2464 2467 } 2465 2468