]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
thunderbolt: property: Cap recursion depth in __tb_property_parse_dir()
authorMichael Bommarito <michael.bommarito@gmail.com>
Sun, 10 May 2026 23:16:58 +0000 (19:16 -0400)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 11 May 2026 09:32:03 +0000 (11:32 +0200)
commit928abe19fbf0127003abcb1ea69cabc1c897d0ab
treeb8dd3a705501eea523295dc03ecbe52971696c30
parentde21b59c29e31c5108ddc04210631bbfab81b997
thunderbolt: property: Cap recursion depth in __tb_property_parse_dir()

A DIRECTORY entry's value field is used as the dir_offset for a
recursive call into __tb_property_parse_dir() with no depth counter.
A crafted peer that chains DIRECTORY entries into a back-reference
loop drives the parser until the kernel stack is exhausted and the
guard page fires.  Any untrusted XDomain peer (cable, dock, in-line
inspector, adjacent host) that reaches the PROPERTIES_REQUEST
control-plane exchange can trigger this without authentication.

Thread a depth counter through tb_property_parse() and
__tb_property_parse_dir(), and reject blocks that exceed
TB_PROPERTY_MAX_DEPTH = 8.  That is comfortably larger than any
observed legitimate XDomain layout.

Operators who do not need XDomain host-to-host discovery can disable
the path entirely with thunderbolt.xdomain=0 on the kernel command
line.

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