diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-09-02 14:31:51 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-09-02 14:31:51 +0200 |
| commit | 864c971e923f55d3ff5ac3ebc87aab8108d30c8a (patch) | |
| tree | 3fd77c646490ad640a4cb7f37c63a1eaf8c2bd7b /include/linux/skbuff.h | |
| parent | 19ccd439d0087525b48dfcc8e584a0a940230744 (diff) | |
| parent | 1c732c6b94f0faee1526bd375add2fe10cba2e26 (diff) | |
Merge v6.18.49linux-rolling-lts
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/skbuff.h')
| -rw-r--r-- | include/linux/skbuff.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index def9cca94817..36a02653665a 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3110,6 +3110,30 @@ static inline void skb_set_transport_header(struct sk_buff *skb, skb->transport_header += offset; } +/** + * skb_set_transport_header_careful - conditionally set transport header + * @skb: buffer to alter + * @offset: offset to add to skb->data + * + * Hardened version of skb_set_transport_header(). + * + * Returns: true if the operation was a success. + */ +static inline bool __must_check +skb_set_transport_header_careful(struct sk_buff *skb, const int offset) +{ + long thoff = skb->data - skb->head + offset; + + if (unlikely(thoff != (typeof(skb->transport_header))thoff)) + return false; + + if (unlikely(thoff == (typeof(skb->transport_header))~0U)) + return false; + + skb->transport_header = thoff; + return true; +} + static inline unsigned char *skb_network_header(const struct sk_buff *skb) { return skb->head + skb->network_header; |
