diff options
author | Eric Dumazet <[email protected]> | 2024-11-05 17:44:00 +0000 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2024-11-06 17:29:14 -0800 |
commit | 78a0cb2f45dc9327f26956c242f7f4b450efff49 (patch) | |
tree | 452be628d569e25962d09abb3d1dba24ee0aff2f | |
parent | 1732e4bedb3e29986da6ea315e8bf8caf74e1e38 (diff) |
net: add debug check in skb_reset_inner_mac_header()
Make sure (skb->data - skb->head) can fit in skb->inner_mac_header
This needs CONFIG_DEBUG_NET=y.
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Joe Damato <[email protected]>
Reviewed-by: Xuan Zhuo <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
-rw-r--r-- | include/linux/skbuff.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 8dafd1295a6e..32a7d8a65b9f 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2982,7 +2982,10 @@ static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) static inline void skb_reset_inner_mac_header(struct sk_buff *skb) { - skb->inner_mac_header = skb->data - skb->head; + long offset = skb->data - skb->head; + + DEBUG_NET_WARN_ON_ONCE(offset != (typeof(skb->inner_mac_header))offset); + skb->inner_mac_header = offset; } static inline void skb_set_inner_mac_header(struct sk_buff *skb, |