iommu/vt-d: check for allocation failure in aux_detach_device()
Subsystems (3)
PATCH 1/1 iommu/vt-d: check for allocation failure in aux_detach_device()
In current kernels small allocations never fail, but checking for allocation failure is the correct thing to do.
Fixes 18abda7a2d55 ("iommu/vt-d: Fix general protection fault in aux_detach_device()")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/iommu/intel/iommu.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iommu/intel/iommu.c +2 -0
@@ -4606,6 +4606,8 @@ static int auxiliary_link_device(struct dmar_domain *domain,if (!sinfo) { sinfo =kzalloc (sizeof (*sinfo),GFP_ATOMIC ); +if (!sinfo) +return -ENOMEM ; sinfo->domain = domain; sinfo->pdev = dev;list_add (&sinfo->link_phys, &info->subdevices);
Signature · 1 line
2.30.2
Quoted 15 lines · Dan Carpenter
In current kernels small allocations never fail, but checking for allocation failure is the correct thing to do.
Fixes 18abda7a2d55 ("iommu/vt-d: Fix general protection fault in aux_detach_device()")Signed-off-by Dan Carpenter <[email protected]>--- drivers/iommu/intel/iommu.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iommu/intel/iommu.c +0
-0
drivers/iommu/intel/iommu.c static int auxiliary_link_device(struct dmar_domain *domain, · line 4613
Quoted 8 lines
drivers/iommu/intel/iommu.c +2
-0@@ -4606,6 +4606,8 @@ static int auxiliary_link_device(struct dmar_domain *domain,if (!sinfo) { sinfo =kzalloc (sizeof (*sinfo),GFP_ATOMIC ); +if (!sinfo) +return -ENOMEM ; sinfo->domain = domain; sinfo->pdev = dev;list_add (&sinfo->link_phys, &info->subdevices);
Thank you!
Acked-by Lu Baolu <[email protected]>
Best regards,
baolu