From: Baolu Lu <baolu.lu@linux.intel.com>
To: Pranjal Shrivastava <praan@google.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: baolu.lu@linux.intel.com, David Woodhouse <dwmw2@infradead.org>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Kevin Tian <kevin.tian@intel.com>,
Samiullah Khawaja <skhawaja@google.com>,
sashiko-bot@kernel.org
Subject: Re: [PATCH 2/2] iommu/vt-d: Fix Use-After-Free in probe error path
Date: Sat, 30 May 2026 21:33:12 +0800 [thread overview]
Message-ID: <fa33f355-a21d-4d6c-ad45-c2bd455a9eab@linux.intel.com> (raw)
In-Reply-To: <20260529113410.491538-3-praan@google.com>
On 5/29/2026 7:34 PM, Pranjal Shrivastava wrote:
> When intel_iommu_probe_device() fails after the info structure has
> been linked to the device via dev_iommu_priv_set(), the error path
> calls kfree(info) but does not clear the pointer in the device
> structure.
>
> This results in a Use-After-Free regression if the pointer is accessed
> by a subsequent IOMMU core call or a re-probe.
>
> Fix this by ensuring dev_iommu_priv_set(dev, NULL) is called before
> freeing the info structure in the error path.
>
> Fixes: 89436f4f5412 ("iommu/vt-d: Fix WARN_ON in iommu probe path")
Fixes: eda1a94caf6b ("iommu: Mark dev_iommu_priv_set() with a lockdep")
> Reported-by: sashiko-bot@kernel.org
> Closes: https://lore.kernel.org/all/20260525205628.CD4431F000E9@smtp.kernel.org/
> Signed-off-by: Pranjal Shrivastava <praan@google.com>
> ---
> drivers/iommu/intel/iommu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 2702e9aa2241..6c718adf97ae 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -3320,6 +3320,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
> clear_rbtree:
> device_rbtree_remove(info);
> free:
> + dev_iommu_priv_set(dev, NULL);
> kfree(info);
>
> return ERR_PTR(ret);
Thanks,
baolu
next prev parent reply other threads:[~2026-05-30 13:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 11:34 [PATCH 0/2] iommu/vt-d: Fix issues on probe error path Pranjal Shrivastava
2026-05-29 11:34 ` [PATCH 1/2] iommu/vt-d: Fix RB-tree corruption in " Pranjal Shrivastava
2026-05-29 11:34 ` [PATCH 2/2] iommu/vt-d: Fix Use-After-Free " Pranjal Shrivastava
2026-05-30 13:33 ` Baolu Lu [this message]
2026-05-31 17:03 ` Pranjal Shrivastava
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=fa33f355-a21d-4d6c-ad45-c2bd455a9eab@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=praan@google.com \
--cc=robin.murphy@arm.com \
--cc=sashiko-bot@kernel.org \
--cc=skhawaja@google.com \
--cc=will@kernel.org \
/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