diff options
author | Eric Dumazet <edumazet@google.com> | 2022-05-09 20:57:39 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-05-11 12:44:16 +0100 |
commit | 66e4c8d950083df8e12981babca788e1635c92b6 (patch) | |
tree | b1739cc30f5456d88562cecc2d1e6665bc6e623e /include | |
parent | d268c1f5cfc92eb5bb605f7365769aacd93be234 (diff) | |
download | lwn-66e4c8d950083df8e12981babca788e1635c92b6.tar.gz lwn-66e4c8d950083df8e12981babca788e1635c92b6.zip |
net: warn if transport header was not set
Make sure skb_transport_header() and skb_transport_offset() uses
are not fooled if the transport header has not been set.
This change will likely expose existing bugs in linux networking stacks.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/skbuff.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 5296b2c37f62..b91d225fdc13 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -42,6 +42,7 @@ #if IS_ENABLED(CONFIG_NF_CONNTRACK) #include <linux/netfilter/nf_conntrack_common.h> #endif +#include <net/net_debug.h> /** * DOC: skb checksums @@ -2904,6 +2905,7 @@ static inline bool skb_transport_header_was_set(const struct sk_buff *skb) static inline unsigned char *skb_transport_header(const struct sk_buff *skb) { + DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb)); return skb->head + skb->transport_header; } |