From: sashiko-bot@kernel.org
To: "Mahanta Jambigi" <mjambigi@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH net] net/smc: unmap the sg table when a DMA map coalesces entries
Date: Fri, 04 Dec 2026 12:53:21 +0000 [thread overview]
Message-ID: <sashiko-outbox-249835@kernel.org> (raw)
In-Reply-To: <20261203125008.2061833-1-mjambigi@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] net/smc: smcr_buf_map_link() unmaps sg table on DMA mapping
failure
- [Medium] net/smc: unused free_table label in smcr_buf_map_link()
breaks build
--
commit 9210b3d201b780d3ddbcb843ac69fe3f41a1f09e
Author: Mahanta Jambigi <mjambigi@linux.ibm.com>
net/smc: unmap the sg table when a DMA map coalesces entries
This commit changes the rc != nents error path in smcr_buf_map_link() to
jump to buf_unmap instead of free_table so that coalesced sg mappings
are unmapped before freeing the sg table.
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index a3164201c1420..0561ef81102d9 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -2226,7 +2226,7 @@ static int smcr_buf_map_link(struct smc_buf_desc *buf_desc, bool is_rmb,
> /* SMC protocol depends on mapping to one DMA address only */
> if (rc != nents) {
> rc = -EAGAIN;
> - goto free_table;
> + goto buf_unmap;
> }
>
> buf_desc->is_dma_need_sync |=
[Severity: High]
Does this call smc_ib_buf_unmap_sg() on an unmapped scatterlist when
ib_dma_map_sg() fails?
smc_ib_buf_map_sg() returns -ENOMEM when ib_dma_map_sg() fails, which
also takes the rc != nents branch. smc_ib_buf_unmap_sg() only skips
unmapping when sgl->dma_address is 0, but iommu_dma_map_sg() and
dma_direct_map_sg() leave DMA_MAPPING_ERROR or rolled-back addresses.
Calling ib_dma_unmap_sg() on that scatterlist violates the DMA API,
triggering CONFIG_DMA_API_DEBUG errors and double-unmapping SWIOTLB
slots or IOVAs. Jumping to free_table when rc < 0 and only to buf_unmap
when rc > 0 avoids unmapping a failed mapping.
[Severity: Medium]
Will removing the only jump to free_table leave an unused label in
smcr_buf_map_link()?
With -Wall enabled in kernel builds, this triggers a -Wunused-label
warning and fails compilation under CONFIG_WERROR=y. Keeping the
free_table target for the rc < 0 path above resolves this as well.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203125008.2061833-1-mjambigi@linux.ibm.com?part=1
prev parent reply other threads:[~2026-12-04 12:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 12:50 [PATCH net] net/smc: unmap the sg table when a DMA map coalesces entries Mahanta Jambigi
2026-12-03 12:53 ` netdev-bot+sinfo
2026-12-04 2:42 ` Dust Li
2026-12-04 5:30 ` Mahanta Jambigi
2026-12-04 3:46 ` kernel test robot
2026-12-04 5:06 ` kernel test robot
2026-12-04 12:53 ` sashiko-bot [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=sashiko-outbox-249835@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjambigi@linux.ibm.com \
--cc=sashiko-reviews@lists.linux.dev \
/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