From: Logan Gunthorpe <logang@deltatee.com>
To: lirongqing <lirongqing@baidu.com>,
Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Lu Baolu <baolu.lu@linux.intel.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Leon Romanovsky <leon@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/dma-iommu: Fix wrong scatterlist length assignment in P2PDMA path
Date: Mon, 1 Jun 2026 10:02:33 -0600 [thread overview]
Message-ID: <c666e384-b365-4891-a01d-736948b995bc@deltatee.com> (raw)
In-Reply-To: <20260530112852.2321-1-lirongqing@baidu.com>
On 2026-05-30 05:28, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> In iommu_dma_map_sg(), when handling PCI P2PDMA cases, the DMA length
> of the current scatterlist segment `s` is incorrectly assigned from the
> head entry `sg->length` instead of the current entry `s->length`.
>
> This typo causes all P2PDMA segments in the scatterlist to inherit the
> length of the first segment, leading to corrupted DMA lengths for multi-
> segment scatterlists.
>
> Fix this by using `s->length` instead of `sg->length`.
>
> Fixes: a25e7962db ("PCI/P2PDMA: Refactor the p2pdma mapping helpers")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
Hmm, I thought I had tested this stuff pretty thoroughly so I'm
surprised I missed that. But I guess seeing the users of these
specifically don't allow mixing with anonymous memory the vast majority
of tests would only have one segment.
Can you confirm that you've reproduced and tested this and it actually
fixes a bug? Not just seeing something that looks strange. I have a
vague feeling it was intentional but looking at the code it looks wrong
to me too.
Thanks,
Logan
next prev parent reply other threads:[~2026-06-01 16:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 11:28 lirongqing
2026-06-01 16:02 ` Logan Gunthorpe [this message]
2026-06-02 6:12 ` 答复: [外部邮件] " Li,Rongqing
2026-06-02 9:48 ` Li,Rongqing
2026-06-02 15:51 ` Logan Gunthorpe
2026-06-02 15:42 ` Logan Gunthorpe
2026-06-11 11:59 ` Jason Gunthorpe
2026-06-11 12:21 ` 答复: " Li,Rongqing
2026-06-12 13:23 ` Joerg Roedel
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=c666e384-b365-4891-a01d-736948b995bc@deltatee.com \
--to=logang@deltatee.com \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=mcgrof@kernel.org \
--cc=robin.murphy@arm.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®