From: wit_yuan <yuanzhaoming901030@126.com>
To: netdev@vger.kernel.org
Cc: Yuan Zhaoming <yuanzm2@lenovo.com>
Subject: [PATCH next-next v2] net:mctp: fix setting mctp hdr ver reserved field cause data dropped
Date: Fri, 10 Apr 2026 14:33:34 +0800 [thread overview]
Message-ID: <20260410063334.7531-2-yuanzhaoming901030@126.com> (raw)
In-Reply-To: <20260410063334.7531-1-yuanzhaoming901030@126.com>
From: Yuan Zhaoming <yuanzm2@lenovo.com>
from spec dsp0236_1.2.1.pdf page 26, the mctp header contains the
RSVD(4bit) and Hdr version(4 bit).
mctp_pkttype_receive invoke mctp_hdr, and get mh->ver whole byte
compare the MCTP_VER_MIN, MCTP_VER_MAX. the reserver bits may be by
misleading used.
one type hba card will set pcie vdm header Pad Len the same with RSVD
bit, this will not work on mctp kernel solution.
Signed-off-by: Yuan Zhaoming <yuanzm2@lenovo.com>
---
include/net/mctp.h | 1 +
net/mctp/route.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/net/mctp.h b/include/net/mctp.h
index f481007a6..1392fafe7 100644
--- a/include/net/mctp.h
+++ b/include/net/mctp.h
@@ -35,6 +35,7 @@ struct mctp_hdr {
#define MCTP_HDR_SEQ_MASK GENMASK(1, 0)
#define MCTP_HDR_TAG_SHIFT 0
#define MCTP_HDR_TAG_MASK GENMASK(2, 0)
+#define MCTP_HDR_VER_MASK GENMASK(3, 0)
#define MCTP_INITIAL_DEFAULT_NET 1
diff --git a/net/mctp/route.c b/net/mctp/route.c
index 56c441e90..aa0e89d67 100644
--- a/net/mctp/route.c
+++ b/net/mctp/route.c
@@ -464,7 +464,7 @@ static int mctp_dst_input(struct mctp_dst *dst, struct sk_buff *skb)
netid = mctp_cb(skb)->net;
skb_pull(skb, sizeof(struct mctp_hdr));
- if (mh->ver != 1)
+ if (((mh->ver & MCTP_HDR_VER_MASK)) < MCTP_VER_MIN || (mh->ver & MCTP_HDR_VER_MASK) > MCTP_VER_MAX)
goto out;
flags = mh->flags_seq_tag & (MCTP_HDR_FLAG_SOM | MCTP_HDR_FLAG_EOM);
@@ -1345,7 +1345,7 @@ static int mctp_pkttype_receive(struct sk_buff *skb, struct net_device *dev,
/* We have enough for a header; decode and route */
mh = mctp_hdr(skb);
- if (mh->ver < MCTP_VER_MIN || mh->ver > MCTP_VER_MAX)
+ if (((mh->ver & MCTP_HDR_VER_MASK)) < MCTP_VER_MIN || (mh->ver & MCTP_HDR_VER_MASK) > MCTP_VER_MAX)
goto err_drop;
/* source must be valid unicast or null; drop reserved ranges and
--
2.43.0
next prev parent reply other threads:[~2026-04-10 6:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ff147a3f0d27ef2aa6026cc86f9113d56a8c61ac.camel@codeconstruct.com.au/T/#rc39d8ae7e5ee7e74556d16fc836cc9f2bf745701>
2026-04-10 6:09 ` wit_yuan
2026-04-10 6:09 ` [PATCH next-next v2] net:mctp: fix setting mctp hdr ver reserved field cause data dropped wit_yuan
2026-04-10 6:33 ` wit_yuan
2026-04-10 6:33 ` wit_yuan [this message]
2026-04-10 0:13 [PATCH] net:mctp: split mctp hdr version to ver and rsvd Jeremy Kerr
2026-04-10 6:17 ` wit_yuan
2026-04-10 6:17 ` [PATCH next-next v2] net:mctp: fix setting mctp hdr ver reserved field cause data dropped wit_yuan
2026-04-10 7:05 ` Jeremy Kerr
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=20260410063334.7531-2-yuanzhaoming901030@126.com \
--to=yuanzhaoming901030@126.com \
--cc=netdev@vger.kernel.org \
--cc=yuanzm2@lenovo.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