* [PATCH] iommu/vt-d: check for allocation failure in aux_detach_device()
@ 2021-05-12 10:05 Dan Carpenter
2021-05-12 11:28 ` Lu Baolu
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-05-12 10:05 UTC (permalink / raw)
To: David Woodhouse, Liu Yi L; +Cc: kernel-janitors, iommu, Will Deacon
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 <dan.carpenter@oracle.com>
---
drivers/iommu/intel/iommu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 708f430af1c4..9a7b79b5af18 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -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);
--
2.30.2
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] iommu/vt-d: check for allocation failure in aux_detach_device()
2021-05-12 10:05 [PATCH] iommu/vt-d: check for allocation failure in aux_detach_device() Dan Carpenter
@ 2021-05-12 11:28 ` Lu Baolu
0 siblings, 0 replies; 2+ messages in thread
From: Lu Baolu @ 2021-05-12 11:28 UTC (permalink / raw)
To: Dan Carpenter, David Woodhouse, Liu Yi L
Cc: kernel-janitors, iommu, Will Deacon
On 5/12/21 6:05 PM, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>
> ---
> drivers/iommu/intel/iommu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 708f430af1c4..9a7b79b5af18 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -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 <baolu.lu@linux.intel.com>
Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-12 11:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-12 10:05 [PATCH] iommu/vt-d: check for allocation failure in aux_detach_device() Dan Carpenter
2021-05-12 11:28 ` Lu Baolu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox