Skip to content

net: prevent buffer overflows in UDP packets

Sascha Hauer barebox 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20260402-net-eth-do-udp-327f4e65ddd5

Versions newest first

  1. v1 Latest10 patches 12 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/10net: add net_eth_to_udp() helper for validated UDP extractioninclude/net.h net/net.c+49 -01 reply
2/10fs: tftp: use net_eth_to_udp() for packet parsingfs/tftp.c+5 -41 reply
3/10net: dhcp: use net_eth_to_udp() for packet parsingnet/dhcp.c+9 -71 reply
4/10fs: nfs: use net_eth_to_udp() for packet parsingfs/nfs.c+7 -41 reply
5/10net: dns: use net_eth_to_udp() for packet parsingnet/dns.c+6 -31 reply
6/10net: sntp: use net_eth_to_udp() for packet parsingnet/sntp.c+9 -51 reply
7/10net: netconsole: use net_eth_to_udp() for packet parsingnet/netconsole.c+5 -21 reply
8/10net: fastboot: use net_eth_to_udp() for packet parsingnet/fastboot.c+14 -71 reply
9/10net: fastboot: stop using net_eth_to_udp_payload() for PACKET_SIZEnet/fastboot.c+2 -21 reply
10/10net: remove unused net_eth_to_udp{hdr,_payload,len}() helpersinclude/net.h+0 -161 reply

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchClaude Opus 4.6Ahmad Fatoum
1/10Co-Authored-By R-b
2/10Co-Authored-By R-b
3/10Co-Authored-By R-b
4/10Co-Authored-By R-b
5/10Co-Authored-By R-b
6/10Co-Authored-By R-b
7/10Co-Authored-By R-b
8/10Co-Authored-By R-b
9/10Co-Authored-By R-b
10/10Co-Authored-By R-b

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 00/10] net: prevent buffer overflows in UDP packets

Our UDP handlers all use a UDP packets length without checking if it fits into the incoming ethernet frame. Create a net_eth_to_udp() helper which does the bounds checking and use it throughout the code.

---
Sascha Hauer (10):
net: add net_eth_to_udp() helper for validated UDP extraction
fs: tftp: use net_eth_to_udp() for packet parsing
net: dhcp: use net_eth_to_udp() for packet parsing
fs: nfs: use net_eth_to_udp() for packet parsing
net: dns: use net_eth_to_udp() for packet parsing
net: sntp: use net_eth_to_udp() for packet parsing
net: netconsole: use net_eth_to_udp() for packet parsing
net: fastboot: use net_eth_to_udp() for packet parsing
net: fastboot: stop using net_eth_to_udp_payload() for PACKET_SIZE
net: remove unused net_eth_to_udp{hdr,_payload,len}() helpers

 fs/nfs.c         | 11 +++++++----
 fs/tftp.c        |  9 +++++----
 include/net.h    | 21 +++++++--------------
 net/dhcp.c       | 16 +++++++++-------
 net/dns.c        |  9 ++++++---
 net/fastboot.c   | 25 ++++++++++++++++---------
 net/net.c        | 40 ++++++++++++++++++++++++++++++++++++++++
 net/netconsole.c |  7 +++++--
 net/sntp.c       | 14 +++++++++-----
 9 files changed, 104 insertions(+), 48 deletions(-)

---
base-commit: 0933e8f2ebf0d91dfcf177a4e4292b02921a53f1
change-id: 20260402-net-eth-do-udp-327f4e65ddd5

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>