]> git.hungrycats.org Git - linux/commit
thunderbolt: Validate XDomain request packet size before type cast
authorMichael Bommarito <michael.bommarito@gmail.com>
Mon, 25 May 2026 09:28:28 +0000 (05:28 -0400)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 26 May 2026 13:18:29 +0000 (15:18 +0200)
commita504b9f2797b739e0304d537e8aa4ce883ecce39
treee01e9a0ce6259805c4ce04a6c4b54da077de2caa
parent322e93448d908434ae5545660fcbe8f5a7a8e141
thunderbolt: Validate XDomain request packet size before type cast

tb_xdp_handle_request() casts the received packet buffer to
protocol-specific structs without verifying that the allocation
is large enough for the target type.  A peer can send a minimal
XDomain packet that passes the generic header length check but is
shorter than the struct accessed after the cast, causing out-of-
bounds reads from the kmemdup allocation.

Plumb the packet length through xdomain_request_work and validate
it against the expected struct size before each cast.

Fixes: 8e1de7042596 ("thunderbolt: Add support for XDomain lane bonding")
Fixes: cdae7c07e3e3 ("thunderbolt: Add support for XDomain properties")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/xdomain.c