mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tushar Nimkar <tunimkar@amd.com>
To: Deepanshu Kartikey <kartikey406@gmail.com>,
	jgg@ziepe.ca, kevin.tian@intel.com, joro@8bytes.org,
	will@kernel.org, robin.murphy@arm.com
Cc: steven.sistare@oracle.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	syzbot+48637757323884de77a2@syzkaller.appspotmail.com,
	Peiyang He <peiyang_he@smail.nju.edu.cn>
Subject: Re: [PATCH] iommufd: Fix NULL deref of area->pages in ioas_change_process
Date: Tue, 18 Aug 2026 11:37:02 +0530	[thread overview]
Message-ID: <28ee8c39-1c30-458e-952e-7b02b2ca0998@amd.com> (raw)
In-Reply-To: <20260818033650.21443-1-kartikey406@gmail.com>

Hey Kartikey,

On 8/18/2026 9:06 AM, Deepanshu Kartikey wrote:
> [You don't often get email from kartikey406@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> Areas are inserted into the area_itree before area->pages is assigned,
> so an area with a NULL pages pointer is briefly visible to readers.
> iommufd_ioas_change_process() walks every area and dereferences
> area->pages unconditionally, which oopses when racing with a
> concurrent IOMMU_IOAS_MAP_FILE.
>
> Reject the racing case with -EBUSY, matching how
> iopt_unmap_iova_range() handles the same window. Checking in the first
> loop covers the whole function since all iova_rwsems are held for
> write across the call.

This is same as submitted by Peiyang

https://lore.kernel.org/all/7344B7A7B9957A65+20260806045059.1884737-1-peiyang_he@smail.nju.edu.cn/ 


- tushar

> Fixes: 829ed626499c ("iommufd: Add IOMMU_IOAS_CHANGE_PROCESS")
> Reported-by: syzbot+48637757323884de77a2@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=48637757323884de77a2
> Tested-by: syzbot+48637757323884de77a2@syzkaller.appspotmail.com
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> ---
>   drivers/iommu/iommufd/ioas.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/iommu/iommufd/ioas.c b/drivers/iommu/iommufd/ioas.c
> index fed06c2b728e..71bffece84b5 100644
> --- a/drivers/iommu/iommufd/ioas.c
> +++ b/drivers/iommu/iommufd/ioas.c
> @@ -535,6 +535,10 @@ int iommufd_ioas_change_process(struct iommufd_ucmd *ucmd)
>                  return rc;
>
>          for_each_ioas_area(&ioas_list, index, ioas, area)  {
> +               if (!area->pages) {
> +                       rc = -EBUSY;
> +                       goto out;
> +               }
>                  if (area->pages->type != IOPT_ADDRESS_FILE) {
>                          rc = -EINVAL;
>                          goto out;
> --
> 2.34.1
>
>

      reply	other threads:[~2026-08-18  6:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  3:36 Deepanshu Kartikey
2026-08-18  6:07 ` Tushar Nimkar [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=28ee8c39-1c30-458e-952e-7b02b2ca0998@amd.com \
    --to=tunimkar@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kartikey406@gmail.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peiyang_he@smail.nju.edu.cn \
    --cc=robin.murphy@arm.com \
    --cc=steven.sistare@oracle.com \
    --cc=syzbot+48637757323884de77a2@syzkaller.appspotmail.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

all inboxes | Powered by JetHome®