linux/net/psp
David Carlier 30cb24f97d psp: strip variable-length PSP header in psp_dev_rcv()
psp_dev_rcv() unconditionally removes a fixed PSP_ENCAP_HLEN, even
when psph->hdrlen indicates that the PSP header carries optional
fields. A frame whose PSP header advertises a non-zero VC or any
extension would therefore be silently mis-decapsulated: option bytes
would spill into the inner packet head and downstream parsing would
fail on a corrupted skb.

Compute the full PSP header length from psph->hdrlen, pull the
optional bytes into the linear region, and strip the whole header
when decapsulating. Optional fields (VC, ...) are still ignored,
just discarded with the rest of the header instead of leaking.
crypt_offset and the VIRT flag are intentionally not validated here
- callers know their device's PSP implementation and can decide.

Both in-tree callers gate on hardware-validated PSP, so this is a
correctness fix rather than a reachable corruption path under
current configurations.

Fixes: 0eddb8023c ("psp: provide decapsulation and receive helper for drivers")
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
Link: https://patch.msgid.link/20260502141945.14484-1-devnexen@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-04 19:25:14 -07:00
..
Kconfig net: psp: select CONFIG_SKB_EXTENSIONS 2026-02-17 17:05:29 -08:00
Makefile net: psp: add socket security association code 2025-09-18 12:32:06 +02:00
psp_main.c psp: strip variable-length PSP header in psp_dev_rcv() 2026-05-04 19:25:14 -07:00
psp_nl.c net: psp: check for device unregister when creating assoc 2026-04-28 17:43:32 -07:00
psp_sock.c net: remove EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL() macros 2026-03-29 11:21:22 -07:00
psp-nl-gen.c net: psp: require admin permission for dev-set and key-rotate 2026-04-28 17:44:20 -07:00
psp-nl-gen.h tools: ynl-gen: add regeneration comment 2025-11-25 19:20:42 -08:00
psp.h psp: rename our psp_dev_destroy() 2025-09-18 07:04:25 -07:00