All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Junjie Cao" <junjie.cao@intel.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
	linux-rdma@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	linux-s390@vger.kernel.org,
	"Alexander Gordeev" <agordeev@linux.ibm.com>
Subject: Re: [PATCH 5.10.y 1/2] net/smc: check smcd_v2_ext_offset when receiving proposal msg
Date: Mon, 21 Sep 2026 05:20:24 +0000	[thread overview]
Message-ID: <20260921052024.C1E7A1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260920051403.712116-2-junjie.cao@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net/smc: protocol regression in SMCv2 proposal parsing due to static max_offset
--

commit 32692cd08a75040e1005cf9b8d09a85a6a7acc74
Author: Guangguan Wang <guangguan.wang@linux.alibaba.com>

net/smc: check smcd_v2_ext_offset when receiving proposal msg
    
When receiving proposal msg in server, the field smcd_v2_ext_offset in
proposal msg is from the remote client and can not be fully trusted.
Once the value of smcd_v2_ext_offset exceed the max value, there has
the chance to access wrong address, and crash may happen.

> diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
> index a57a3489df4ae..f7f656b297f9c 100644
> --- a/net/smc/smc_clc.h
> +++ b/net/smc/smc_clc.h
> @@ -306,9 +306,15 @@ smc_get_clc_v2_ext(struct smc_clc_msg_proposal *prop)
>  static inline struct smc_clc_smcd_v2_extension *
>  smc_get_clc_smcd_v2_ext(struct smc_clc_v2_extension *prop_v2ext)
>  {
> +	u16 max_offset = offsetof(struct smc_clc_msg_proposal_area, pclc_smcd_v2_ext) -
> +		offsetof(struct smc_clc_msg_proposal_area, pclc_v2_ext) -
> +		offsetof(struct smc_clc_v2_extension, hdr) -
> +		offsetofend(struct smc_clnt_opts_area_hdr, smcd_v2_ext_offset);
> +

[Severity: High]
Does this static calculation ignore the dynamic size of the flexible
user_eids array in struct smc_clc_v2_extension?

By not accounting for the user_eids array, max_offset appears strictly
limited to the case where eid_cnt = 0.

>  	if (!prop_v2ext)
>  		return NULL;
> -	if (!ntohs(prop_v2ext->hdr.smcd_v2_ext_offset))
> +	if (!ntohs(prop_v2ext->hdr.smcd_v2_ext_offset) ||
> +	    ntohs(prop_v2ext->hdr.smcd_v2_ext_offset) > max_offset)
>  		return NULL;

[Severity: High]
Will this falsely flag valid offsets as out-of-bounds when the proposal
includes user EIDs?

When an untrusted remote peer initiates an SMC-D v2 connection proposing
one or more user EIDs (up to SMC_CLC_MAX_UEID), the packet may be
correctly sized and well-formed.

However, because max_offset ignores the flexible user_eids array, this
check returns NULL and drops the capability, breaking protocol compliance
and interoperability with SMCv2 peers that use Enterprise IDs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260920051403.712116-1-junjie.cao@intel.com?part=1

  reply	other threads:[~2026-09-21  5:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  5:14 [PATCH 5.10.y 0/2] net/smc: bound v2 extension offsets and counts in CLC proposal Junjie Cao
2026-09-20  5:14 ` [PATCH 5.10.y 1/2] net/smc: check smcd_v2_ext_offset when receiving proposal msg Junjie Cao
2026-09-21  5:20   ` sashiko-bot [this message]
2026-09-20  5:16 ` [PATCH 5.10.y 2/2] net/smc: check v2_ext_offset/eid_cnt/ism_gid_cnt " Junjie Cao
2026-09-21  5:20   ` sashiko-bot
2026-09-20 17:50 ` [PATCH 5.10.y 0/2] net/smc: bound v2 extension offsets and counts in CLC proposal Sasha Levin

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=20260921052024.C1E7A1F00893@smtp.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=junjie.cao@intel.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.