iommu/vt-d: Fix dereference of pointer info before it is null checked
The assignment of iommu from info->iommu occurs before info is null checked hence leading to a potential null pointer dereference issue. Fix this by assigning iommu and checking if iommu is null after null checking info. Addresses-Coverity: ("Dereference before null check") Fixes: 4c82b88696ac ("iommu/vt-d: Allocate/register iopf queue for sva devices") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210611135024.32781-1-colin.king@canonical.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
d6a9642bd6
commit
934ed4580c
@ -5329,10 +5329,14 @@ static int intel_iommu_disable_auxd(struct device *dev)
|
||||
static int intel_iommu_enable_sva(struct device *dev)
|
||||
{
|
||||
struct device_domain_info *info = get_domain_info(dev);
|
||||
struct intel_iommu *iommu = info->iommu;
|
||||
struct intel_iommu *iommu;
|
||||
int ret;
|
||||
|
||||
if (!info || !iommu || dmar_disabled)
|
||||
if (!info || dmar_disabled)
|
||||
return -EINVAL;
|
||||
|
||||
iommu = info->iommu;
|
||||
if (!iommu)
|
||||
return -EINVAL;
|
||||
|
||||
if (!(iommu->flags & VTD_FLAG_SVM_CAPABLE))
|
||||
|
Loading…
x
Reference in New Issue
Block a user