Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: mctp: fix don't require received header reserved bits to be zero

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 <yuanzm2@lenovo.com>
Cc: stable@vger.kernel.org
Acked-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://patch.msgid.link/20260417141340.5306-1-yuanzhaoming901030@126.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Yuan Zhaoming and committed by
Jakub Kicinski
a663bac7 5638504a

+9 -2
+3
include/net/mctp.h
··· 26 26 #define MCTP_VER_MIN 1 27 27 #define MCTP_VER_MAX 1 28 28 29 + /* Definitions for ver field */ 30 + #define MCTP_HDR_VER_MASK GENMASK(3, 0) 31 + 29 32 /* Definitions for flags_seq_tag field */ 30 33 #define MCTP_HDR_FLAG_SOM BIT(7) 31 34 #define MCTP_HDR_FLAG_EOM BIT(6)
+6 -2
net/mctp/route.c
··· 441 441 unsigned long f; 442 442 u8 tag, flags; 443 443 int rc; 444 + u8 ver; 444 445 445 446 msk = NULL; 446 447 rc = -EINVAL; ··· 468 467 netid = mctp_cb(skb)->net; 469 468 skb_pull(skb, sizeof(struct mctp_hdr)); 470 469 471 - if (mh->ver != 1) 470 + ver = mh->ver & MCTP_HDR_VER_MASK; 471 + if (ver < MCTP_VER_MIN || ver > MCTP_VER_MAX) 472 472 goto out; 473 473 474 474 flags = mh->flags_seq_tag & (MCTP_HDR_FLAG_SOM | MCTP_HDR_FLAG_EOM); ··· 1319 1317 struct mctp_dst dst; 1320 1318 struct mctp_hdr *mh; 1321 1319 int rc; 1320 + u8 ver; 1322 1321 1323 1322 rcu_read_lock(); 1324 1323 mdev = __mctp_dev_get(dev); ··· 1337 1334 1338 1335 /* We have enough for a header; decode and route */ 1339 1336 mh = mctp_hdr(skb); 1340 - if (mh->ver < MCTP_VER_MIN || mh->ver > MCTP_VER_MAX) 1337 + ver = mh->ver & MCTP_HDR_VER_MASK; 1338 + if (ver < MCTP_VER_MIN || ver > MCTP_VER_MAX) 1341 1339 goto err_drop; 1342 1340 1343 1341 /* source must be valid unicast or null; drop reserved ranges and