Skip to content

Commit

Permalink
iommu/vt-d: Check for allocation failure in aux_detach_device()
Browse files Browse the repository at this point in the history
[ Upstream commit 1a590a1 ]

In current kernels small allocations never fail, but checking for
allocation failure is the correct thing to do.

Fixes: 18abda7 ("iommu/vt-d: Fix general protection fault in aux_detach_device()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/YJuobKuSn81dOPLd@mwanda
Link: https://lore.kernel.org/r/20210519015027.108468-2-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Jun 3, 2021
1 parent 9f6c817 commit 73b31d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/iommu/intel/iommu.c
Expand Up @@ -4626,6 +4626,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);
Expand Down

0 comments on commit 73b31d8

Please sign in to comment.