From: Fushuai Wang <fushuai.wang@linux.dev>
To: jgg@ziepe.ca, kevin.tian@intel.com, joro@8bytes.org,
will@kernel.org, robin.murphy@arm.com, nicolinc@nvidia.com
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
wangfushuai@baidu.com,
syzbot+a0c841e02f328005bbcc@syzkaller.appspotmail.com
Subject: [PATCH] iommufd: Initialize batch->kind field in pfn_batch
Date: Mon, 26 Jan 2026 11:24:38 +0800 [thread overview]
Message-ID: <20260126032438.63303-1-fushuai.wang@linux.dev> (raw)
From: Fushuai Wang <wangfushuai@baidu.com>
The commit 3114c674401e ("iommufd: Allow MMIO pages in a batch")
added a new 'kind' field to struct pfn_batch but failed to initialize
it.
This leads to KMSAN detecting uninitialized-value usage when
batch->kind is first read in batch_add_pfn_num():
iopt_pages_unfill_xarray+0x86/0x1660
iopt_area_remove_access+0x508/0x650
Initialize batch->kind to BATCH_CPU_MEMORY in batch_clear{_array}.
Fixes: 3114c674401e ("iommufd: Allow MMIO pages in a batch")
Reported-by: syzbot+a0c841e02f328005bbcc@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6975b1f4.a00a0220.33ccc7.001f.GAE@google.com/T/
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
drivers/iommu/iommufd/pages.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iommu/iommufd/pages.c b/drivers/iommu/iommufd/pages.c
index dbe51ecb9a20..064f2cf32cc1 100644
--- a/drivers/iommu/iommufd/pages.c
+++ b/drivers/iommu/iommufd/pages.c
@@ -289,6 +289,7 @@ static void batch_clear(struct pfn_batch *batch)
batch->end = 0;
batch->pfns[0] = 0;
batch->npfns[0] = 0;
+ batch->kind = BATCH_CPU_MEMORY;
}
/*
@@ -309,6 +310,7 @@ static void batch_clear_carry(struct pfn_batch *batch, unsigned int keep_pfns)
(batch->npfns[batch->end - 1] - keep_pfns);
batch->npfns[0] = keep_pfns;
batch->end = 1;
+ batch->kind = BATCH_CPU_MEMORY;
}
static void batch_skip_carry(struct pfn_batch *batch, unsigned int skip_pfns)
--
2.36.1
next reply other threads:[~2026-01-26 3:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 3:24 Fushuai Wang [this message]
2026-01-26 7:55 ` Tian, Kevin
2026-01-26 8:05 ` Fushuai Wang
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=20260126032438.63303-1-fushuai.wang@linux.dev \
--to=fushuai.wang@linux.dev \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=syzbot+a0c841e02f328005bbcc@syzkaller.appspotmail.com \
--cc=wangfushuai@baidu.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®