From: Dust Li <dust.li@linux.alibaba.com>
To: "D. Wythe" <alibuda@linux.alibaba.com>,
mjambigi@linux.ibm.com, wenjia@linux.ibm.com,
wintera@linux.ibm.com, tonylu@linux.alibaba.com,
guwen@linux.alibaba.com
Cc: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org,
pabeni@redhat.com, edumazet@google.com, sidraya@linux.ibm.com,
jaka@linux.ibm.com
Subject: Re: [PATCH net-next v3 1/3] net/smc: clear the correct v2 slot and buffer in smc_wr_tx_put_slot()
Date: Tue, 14 Jul 2026 16:05:06 +0800 [thread overview]
Message-ID: <alXtstsR477AuKPD@linux.alibaba.com> (raw)
In-Reply-To: <20260710033356.16460-2-alibuda@linux.alibaba.com>
On 2026-07-10 11:33:54, D. Wythe wrote:
>smc_wr_tx_put_slot() tries to reset the v2 pending slot and buffer with
>memset(&link->wr_tx_v2_pend, 0, sizeof(link->wr_tx_v2_pend)) and the
>equivalent for wr_tx_buf_v2. Both are pointers, so this zeroes the 8-byte
>pointer variable instead of the structure it points to. The pending slot
>and buffer are therefore never actually cleared, and the pointers get
>overwritten with NULL.
>
>Pass the pointers directly and use sizeof(*pointer) so the intended
>structures are cleared.
>
>Fixes: 8799e310fb3f ("net/smc: add v2 support to the work request layer")
>Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
Best regards,
Dust
>---
> net/smc/smc_wr.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
>index 59c92b46945c..6b5add922993 100644
>--- a/net/smc/smc_wr.c
>+++ b/net/smc/smc_wr.c
>@@ -288,10 +288,10 @@ int smc_wr_tx_put_slot(struct smc_link *link,
> } else if (link->lgr->smc_version == SMC_V2 &&
> pend->idx == link->wr_tx_cnt) {
> /* Large v2 buffer */
>- memset(&link->wr_tx_v2_pend, 0,
>- sizeof(link->wr_tx_v2_pend));
>- memset(&link->lgr->wr_tx_buf_v2, 0,
>- sizeof(link->lgr->wr_tx_buf_v2));
>+ memset(link->wr_tx_v2_pend, 0,
>+ sizeof(*link->wr_tx_v2_pend));
>+ memset(link->lgr->wr_tx_buf_v2, 0,
>+ sizeof(*link->lgr->wr_tx_buf_v2));
> return 1;
> }
>
>--
>2.45.0
next prev parent reply other threads:[~2026-07-14 8:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 3:33 [PATCH net-next v3 0/3] net/smc: transition to RDMA core CQ pooling D. Wythe
2026-07-10 3:33 ` [PATCH net-next v3 1/3] net/smc: clear the correct v2 slot and buffer in smc_wr_tx_put_slot() D. Wythe
2026-07-14 8:05 ` Dust Li [this message]
2026-07-10 3:33 ` [PATCH net-next v3 2/3] net/smc: transition to RDMA core CQ pooling D. Wythe
2026-07-11 3:34 ` sashiko-bot
2026-07-10 3:33 ` [PATCH net-next v3 3/3] net/smc: reduce TX slot contention with exclusive wait D. Wythe
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=alXtstsR477AuKPD@linux.alibaba.com \
--to=dust.li@linux.alibaba.com \
--cc=alibuda@linux.alibaba.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=guwen@linux.alibaba.com \
--cc=jaka@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjambigi@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
--cc=wenjia@linux.ibm.com \
--cc=wintera@linux.ibm.com \
/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