From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EA8313DEAED; Mon, 4 May 2026 14:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904861; cv=none; b=GljXtsLtcvnROJkCBtgDEmi66xbnWQaj8Pkm2l/1W7MVh5gLyFDcVEoFSRCy9xfDlaSRe/pureksdiVZ1P3YL6cy4V0S0hcZL4lXg5TDq5w8X0d3/MMWm8nE7jtjfIUdgMJ7SzVsLRDVEOs68MIz5i6ghIXfcGtNYyKaeQ939Vk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904861; c=relaxed/simple; bh=Rmq/PfEtAFxSAFEn6+iOpG+i2LdKc8WlH9bhM/nqwZ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KPjfJMpV8E395wDqZPYlP/a+dn5aHbuJ8jJ5e6vQVYDnFiR3blo8Y8npoBmQKSuXBLWqeZNT9M5v1JXwDdkzJDzGGmKZo+yL0QFWatnEMb1En8Ig+6rY48lQkzaD42f60NwB4ll/hlFiiGlT6A/Q65hFlbp1j6XgRuTVZ/fy58E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fUctIaD5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fUctIaD5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82B8CC2BCB8; Mon, 4 May 2026 14:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777904860; bh=Rmq/PfEtAFxSAFEn6+iOpG+i2LdKc8WlH9bhM/nqwZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fUctIaD5qfQ5rc1KUjXsAdqwzrHLW1qo4DYDqgu/nIf0S8TRwCO/DHw9TY4y31k0v 6GW4JAZ6zb7ftb2jaQ/HgTK9L2EkmRZjBvzAg1fH/A3j/xN9ZsOkoRtDH6irzRmqMf IChFGv9fA2DtmHnKlqKnU54zH3DtSP1ECSLfjreY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuan Zhaoming , Jeremy Kerr , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 201/215] net: mctp: fix dont require received header reserved bits to be zero Date: Mon, 4 May 2026 15:53:40 +0200 Message-ID: <20260504135138.002194006@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504135130.169210693@linuxfoundation.org> References: <20260504135130.169210693@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuan Zhaoming [ Upstream commit a663bac71a2f0b3ac6c373168ca57b2a6e6381aa ] >>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 Acked-by: Jeremy Kerr Link: https://patch.msgid.link/20260417141340.5306-1-yuanzhaoming901030@126.com Signed-off-by: Jakub Kicinski [ Context ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- include/net/mctp.h | 3 +++ net/mctp/route.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) --- 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) --- a/net/mctp/route.c +++ b/net/mctp/route.c @@ -388,6 +388,7 @@ static int mctp_route_input(struct mctp_ unsigned long f; u8 tag, flags; int rc; + u8 ver; msk = NULL; rc = -EINVAL; @@ -411,7 +412,8 @@ static int mctp_route_input(struct mctp_ 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); @@ -1197,6 +1199,7 @@ static int mctp_pkttype_receive(struct s struct mctp_skb_cb *cb; struct mctp_route *rt; struct mctp_hdr *mh; + u8 ver; rcu_read_lock(); mdev = __mctp_dev_get(dev); @@ -1214,7 +1217,8 @@ static int mctp_pkttype_receive(struct s /* 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