mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
net: skbuff: reject zero MPLS TTL before decrementing
skb_mpls_dec_ttl() decrements the u8 TTL before checking whether it
expired. An incoming TTL of zero wraps to 255, causing the TC MPLS
dec_ttl action to pass an expired packet instead of dropping it.
Reject a zero TTL before the decrement while preserving the existing
behavior for TTL one and valid TTL values.
Fixes: 2a2ea50870 ("net: sched: add mpls manipulation actions to TC")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261031114135.3784868-2-thnkslprpt@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
c4328134f3
commit
24614e72df
|
|
@ -6858,7 +6858,7 @@ int skb_mpls_dec_ttl(struct sk_buff *skb)
|
|||
|
||||
lse = be32_to_cpu(mpls_hdr(skb)->label_stack_entry);
|
||||
ttl = (lse & MPLS_LS_TTL_MASK) >> MPLS_LS_TTL_SHIFT;
|
||||
if (!--ttl)
|
||||
if (!ttl || !--ttl)
|
||||
return -EINVAL;
|
||||
|
||||
lse &= ~MPLS_LS_TTL_MASK;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user