Skip to content

nsh: limit recursion in nsh_gso_segment()

Eric Dumazet netdev 1 version Applied

Status from this message: This series was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2nsh: limit recursion in nsh_gso_segment()include/net/gso.h net/nsh/nsh.c+8 -13 repliesApplied
2/2selftests: net: add a test for NSH GSOtools/testing/selftests/net/.gitignore tools/testing/selftests/net/Makefile tools/testing/selftests/net/config +2 more+201 -00 repliesApplied

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchJiri BencWillem de Bruijn
1/2R-b R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net 0/2] nsh: limit recursion in nsh_gso_segment()

Sashiko found that nsh_gso_segment() can call itself, through skb_mac_gso_segment(), once per stacked NSH header. Nothing limits the depth, and a 64KB GSO packet made of 8-byte NSH headers overflows the kernel stack. It was reported while reviewing an unrelated virtio series [1].

Such a packet can be sent with a packet socket using PACKET_VNET_HDR, when the nsh module is loaded.

Patch 1 uses the recursion counter added in commit 006c8b834aed ("net:
gso: limit recursive IP-in-IP segmentation"), with the same limit as IPv4 and IPv6.

Patch 2 adds a selftest: it panics an unfixed kernel, and passes with patch 1.

[1] https://lore.kernel.org/netdev/[email protected]/

Eric Dumazet (2):
nsh: limit recursion in nsh_gso_segment()
selftests: net: add a test for NSH GSO

 include/net/gso.h                      |   2 +-
 net/nsh/nsh.c                          |   7 ++
 tools/testing/selftests/net/.gitignore |   1 +
 tools/testing/selftests/net/Makefile   |   2 +
 tools/testing/selftests/net/config     |   1 +
 tools/testing/selftests/net/nsh_gso.c  | 126 +++++++++++++++++++++++++
 tools/testing/selftests/net/nsh_gso.sh |  71 ++++++++++++++
 7 files changed, 209 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/net/nsh_gso.c
 create mode 100755 tools/testing/selftests/net/nsh_gso.sh

base-commit: 145480b28ca82e9fae789427cc4569e596515a32

Signature · 1 line
2.53.0