From: Dave Jiang <dave.jiang@intel.com>
To: dmaengine@vger.kernel.org
Cc: Frank.Li@kernel.org, vkoul@kernel.org,
syzbot+79a6b3f7a8df01f58774@syzkaller.appspotmail.com
Subject: [PATCH] dmaengine: ioat: reject a non-memory BAR 0 in probe
Date: Mon, 30 Nov 2026 09:24:25 -0700 [thread overview]
Message-ID: <20261130162425.4155575-1-dave.jiang@intel.com> (raw)
ioat_pci_probe() reads the version register from BAR 0 with readb().
If the device's BAR 0 is an I/O port BAR, pci_iomap() returns a port
cookie rather than an MMIO address, and readb() faults on it.
Normal ID matching never binds such a device, but driver_override
can. Return -ENODEV if BAR 0 is not a memory BAR.
Reported-by: syzbot+79a6b3f7a8df01f58774@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=79a6b3f7a8df01f58774
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
It's a defensive measure more than anything. Reproduced by forcing the
ioatdma driver onto a different PCI device. Will not add a Fixes tag.
---
drivers/dma/ioat/init.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index a57024c4b066..48b855d5deff 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -1355,6 +1355,9 @@ static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (err)
return err;
+ if (!(pci_resource_flags(pdev, IOAT_MMIO_BAR) & IORESOURCE_MEM))
+ return -ENODEV;
+
err = pcim_iomap_regions(pdev, 1 << IOAT_MMIO_BAR, DRV_NAME);
if (err)
return err;
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.54.0
reply other threads:[~2026-11-30 16:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261130162425.4155575-1-dave.jiang@intel.com \
--to=dave.jiang@intel.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=syzbot+79a6b3f7a8df01f58774@syzkaller.appspotmail.com \
--cc=vkoul@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