From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C68BC371876; Fri, 17 Apr 2026 14:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776435294; cv=none; b=Ru5o6MunMU6w30yzIg/SbxnA/gFtZYxDMM82QTeQUt1pFzW7fyk0pLxxSPX5gBsz6Z0wuXAaDJpAAbAnhyQgAJf+O9hu3WJUPazM8rQn2yUsz1sUtULevGCYWryZzf/XgcxHkVnWxGqImH6X5eFTseS583W9iXsJkhTdY5w61LU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776435294; c=relaxed/simple; bh=UcWqhakrEd57ECDQhQUL63X3kiHBo5XhtzoZuemImfA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=GLpSnSlq0pu0WbyS2ScqsiJ1xP7m0CPu1pxRFq1CeY/TeeMQFTENQxzKayYn4q4sbYsi5cPP98JVE9+LBPBqm0II7hNjuIfZmyOPfFUVaiVX4qLbFs9Bd7gKiY2/ADdUx1G25lVt01ISnQ8lVUXkaJ15hwXwcekEuU03KixmMKo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com; spf=pass smtp.mailfrom=126.com; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b=Y/JUPxAe; arc=none smtp.client-ip=117.135.210.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="Y/JUPxAe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=+b 63YXL1Sdr42BET7P5BPnfQG+t/53biyDApjuZIQXs=; b=Y/JUPxAeE/6hff/QQT +hNdoEacPke9fj8iYNTkIsR3TdMzI3fvH/zWn4POBQb0gdQd4pQjy20e5t1Z/3WR 03LoX2c6BlhA9ZQ1XAh0W1wAvtA8QHMpuwMxyNMoz/idjceA6DHEtqxxFh2FdEi0 RjivMbVaP/n1RibPiH1A0frF8= Received: from YUANZM2-F4WK0J3.lenovo.com (unknown []) by gzga-smtp-mtada-g0-4 (Coremail) with SMTP id _____wD31+AYQOJpGgMMBw--.55074S2; Fri, 17 Apr 2026 22:13:46 +0800 (CST) From: wit_yuan To: jk@codeconstruct.com.au Cc: yuanzhaoming901030@126.com, yuanzm2@lenovo.com, matt@codeconstruct.com.au, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net] net: mctp: fix don't require received header reserved bits to be zero Date: Fri, 17 Apr 2026 22:13:40 +0800 Message-Id: <20260417141340.5306-1-yuanzhaoming901030@126.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD31+AYQOJpGgMMBw--.55074S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAFW8urW5uFW5Jr4kCFWruFg_yoW5Ww43pF 1DKFWj9rWkKry7Gw4kAa1kZasYgwn5Ka43Cr4Igw4Iv3Waqr18WFy09r4UWr1UurZrGF93 XrWa934UX3ZFqFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zi89NfUUUUU= X-CM-SenderInfo: h1xd065kdrzxtqjziiqqtqqiyswou0bp/xtbBsRopNGniQBpWOwAA3K From: Yuan Zhaoming >From the MCTP Base specification (DSP0236 v1.2.1), the first byte of the MCTP header contains a 4 bit reserved field, and 4 bit version. On our current receive path, we require those 4 reserved bits to be zero, but the 9500-8i card is non-conformant, and may set these reserved bits. DSP0236 states that the reserved bits must be written as zero, and ignored when read. While the device might not conform to the former, we should accept these message to conform to the latter. Relax our check on the MCTP version byte to allow non-zero bits in the reserved field. Fixes: 889b7da23abf ("mctp: Add initial routing framework") Signed-off-by: Yuan Zhaoming Cc: stable@vger.kernel.org --- v3: https://lore.kernel.org/netdev/acd54f40-fcd7-44df-9fe6-0b278f4a3476@redhat.com/T/#t v2: https://lore.kernel.org/netdev/20260410144339.0d1b289a@kernel.org/T/#t v1: https://lore.kernel.org/netdev/ff147a3f0d27ef2aa6026cc86f9113d56a8c61ac.camel@codeconstruct.com.au/T/#t --- include/net/mctp.h | 3 +++ net/mctp/route.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/net/mctp.h b/include/net/mctp.h index 3de6556..3d008b0 100644 --- a/include/net/mctp.h +++ b/include/net/mctp.h @@ -26,6 +26,9 @@ struct mctp_hdr { #define MCTP_VER_MIN 1 #define MCTP_VER_MAX 1 +/* Definitions for ver field */ +#define MCTP_HDR_VER_MASK GENMASK(3, 0) + /* Definitions for flags_seq_tag field */ #define MCTP_HDR_FLAG_SOM BIT(7) #define MCTP_HDR_FLAG_EOM BIT(6) diff --git a/net/mctp/route.c b/net/mctp/route.c index 26cb415..1236ea2 100644 --- a/net/mctp/route.c +++ b/net/mctp/route.c @@ -441,6 +441,7 @@ static int mctp_dst_input(struct mctp_dst *dst, struct sk_buff *skb) unsigned long f; u8 tag, flags; int rc; + u8 ver; msk = NULL; rc = -EINVAL; @@ -467,7 +468,8 @@ 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) + ver = mh->ver & MCTP_HDR_VER_MASK; + if (ver < MCTP_VER_MIN || ver > MCTP_VER_MAX) goto out; flags = mh->flags_seq_tag & (MCTP_HDR_FLAG_SOM | MCTP_HDR_FLAG_EOM); @@ -1317,6 +1319,7 @@ static int mctp_pkttype_receive(struct sk_buff *skb, struct net_device *dev, struct mctp_dst dst; struct mctp_hdr *mh; int rc; + u8 ver; rcu_read_lock(); mdev = __mctp_dev_get(dev); @@ -1334,7 +1337,8 @@ 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) + ver = mh->ver & MCTP_HDR_VER_MASK; + if (ver < MCTP_VER_MIN || ver > MCTP_VER_MAX) goto err_drop; /* source must be valid unicast or null; drop reserved ranges and -- 2.43.0