Linux IOMMU Development
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Liu Yi L <yi.l.liu@intel.com>
Cc: kernel-janitors@vger.kernel.org,
	iommu@lists.linux-foundation.org, Will Deacon <will@kernel.org>
Subject: Re: [PATCH] iommu/vt-d: check for allocation failure in aux_detach_device()
Date: Wed, 12 May 2021 19:28:21 +0800	[thread overview]
Message-ID: <df451f5a-87e6-b101-a7f0-cb24d85fa7ca@linux.intel.com> (raw)
In-Reply-To: <YJuobKuSn81dOPLd@mwanda>

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

      reply	other threads:[~2021-05-12 11:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df451f5a-87e6-b101-a7f0-cb24d85fa7ca@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox