* [PATCH] net/sched: act_pedit: require matching IPv4 L4 protocol
@ 2026-06-05 19:46 Samuel Moelius
0 siblings, 0 replies; only message in thread
From: Samuel Moelius @ 2026-06-05 19:46 UTC (permalink / raw)
To: Jamal Hadi Salim
Cc: Samuel Moelius, Jiri Pirko, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, open list:TC subsystem,
open list
The extended IPv4 L4 header mode in act_pedit can select TCP or UDP
header fields without confirming that the IPv4 protocol field matches
the selected transport header.
That lets a rule written for TCP or UDP modify unrelated payload bytes
in a packet carrying a different protocol.
Verify the IPv4 protocol before applying TCP or UDP extended header
edits.
Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
---
net/sched/act_pedit.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index bc20f08a2789..9a4590451f7e 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -341,6 +341,8 @@ static int pedit_l4_skb_offset(struct sk_buff *skb, int *hoffset, const int head
if (!iph)
goto out;
+ if (iph->ihl < 5 || iph->protocol != header_type)
+ goto out;
*hoffset = noff + iph->ihl * 4;
ret = 0;
break;
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-05 19:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 19:46 [PATCH] net/sched: act_pedit: require matching IPv4 L4 protocol Samuel Moelius
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox