From: Matthew Rosato <mjrosato@linux.ibm.com>
To: Wen Gu <guwen@linux.alibaba.com>,
wintera@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: alibuda@linux.alibaba.com, tonylu@linux.alibaba.com,
linux-s390@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net/smc: fix incorrect SMC-D link group matching logic
Date: Thu, 25 Jan 2024 10:29:02 -0500 [thread overview]
Message-ID: <05f26b9a-9fbb-40ed-8a8a-3cb3549b1097@linux.ibm.com> (raw)
In-Reply-To: <20240125123916.77928-1-guwen@linux.alibaba.com>
On 1/25/24 7:39 AM, Wen Gu wrote:
> The logic to determine if SMC-D link group matches is incorrect. The
> correct logic should be that it only returns true when the GID is the
> same, and the SMC-D device is the same and the extended GID is the same
> (in the case of virtual ISM).
>
> It can be fixed by adding brackets around the conditional (or ternary)
> operator expression. But for better readability and maintainability, it
> has been changed to an if-else statement.
>
> Reported-by: Matthew Rosato <mjrosato@linux.ibm.com>
> Closes: https://lore.kernel.org/r/13579588-eb9d-4626-a063-c0b77ed80f11@linux.ibm.com
> Fixes: b40584d14570 ("net/smc: compatible with 128-bits extended GID of virtual ISM device")
> Link: https://lore.kernel.org/r/13579588-eb9d-4626-a063-c0b77ed80f11@linux.ibm.com
> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
Hi Wen Gu,
I just ran the same series of tests with this patch applied and it resolves the issue for me. Thanks for the quick fix!
Thanks,
Matt
> ---
> net/smc/smc_core.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index 95cc95458e2d..e4c858411207 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -1877,9 +1877,15 @@ static bool smcd_lgr_match(struct smc_link_group *lgr,
> struct smcd_dev *smcismdev,
> struct smcd_gid *peer_gid)
> {
> - return lgr->peer_gid.gid == peer_gid->gid && lgr->smcd == smcismdev &&
> - smc_ism_is_virtual(smcismdev) ?
> - (lgr->peer_gid.gid_ext == peer_gid->gid_ext) : 1;
> + if (lgr->peer_gid.gid != peer_gid->gid ||
> + lgr->smcd != smcismdev)
> + return false;
> +
> + if (smc_ism_is_virtual(smcismdev) &&
> + lgr->peer_gid.gid_ext != peer_gid->gid_ext)
> + return false;
> +
> + return true;
> }
>
> /* create a new SMC connection (and a new link group if necessary) */
next prev parent reply other threads:[~2024-01-25 15:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 12:39 [PATCH net] net/smc: fix incorrect SMC-D link group matching logic Wen Gu
2024-01-25 15:26 ` Alexandra Winter
2024-01-25 15:29 ` Matthew Rosato [this message]
2024-01-26 22:10 ` patchwork-bot+netdevbpf
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=05f26b9a-9fbb-40ed-8a8a-3cb3549b1097@linux.ibm.com \
--to=mjrosato@linux.ibm.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-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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