hulk inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9HVTH CVE: CVE-2024-26921
--------------------------------
Fix KABI break when backport commit 7f678def99d2 ("skb_expand_head() adjust skb->truesize incorrectly") by moving is_skb_wmem() into a private .h file.
Fixes: 7f678def99d2 ("skb_expand_head() adjust skb->truesize incorrectly") Signed-off-by: Ziyang Xuan william.xuanziyang@huawei.com --- include/net/tcp.h | 2 +- net/core/sock_destructor.h => include/net/tcp_ext.h | 10 ++++++---- net/core/skbuff.c | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) rename net/core/sock_destructor.h => include/net/tcp_ext.h (72%)
diff --git a/include/net/tcp.h b/include/net/tcp.h index 44deff714e93..68e67b79534b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -43,6 +43,7 @@ #include <net/tcp_states.h> #include <net/inet_ecn.h> #include <net/dst.h> +#include <net/tcp_ext.h>
#include <linux/seq_file.h> #include <linux/memcontrol.h> @@ -338,7 +339,6 @@ int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, size_t size, int flags); void tcp_release_cb(struct sock *sk); -void tcp_wfree(struct sk_buff *skb); void tcp_write_timer_handler(struct sock *sk); void tcp_delack_timer_handler(struct sock *sk); int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); diff --git a/net/core/sock_destructor.h b/include/net/tcp_ext.h similarity index 72% rename from net/core/sock_destructor.h rename to include/net/tcp_ext.h index 2f396e6bfba5..733534808c4c 100644 --- a/net/core/sock_destructor.h +++ b/include/net/tcp_ext.h @@ -1,7 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef _NET_CORE_SOCK_DESTRUCTOR_H -#define _NET_CORE_SOCK_DESTRUCTOR_H -#include <net/tcp.h> + +#ifndef _TCP_EXT_H +#define _TCP_EXT_H + +void tcp_wfree(struct sk_buff *skb);
static inline bool is_skb_wmem(const struct sk_buff *skb) { @@ -9,4 +11,4 @@ static inline bool is_skb_wmem(const struct sk_buff *skb) skb->destructor == __sock_wfree || (IS_ENABLED(CONFIG_INET) && skb->destructor == tcp_wfree); } -#endif +#endif /* _TCP_EXT_H */ diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 1e0999f22f0b..4953be162818 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -70,6 +70,7 @@ #include <net/checksum.h> #include <net/ip6_checksum.h> #include <net/xfrm.h> +#include <net/tcp_ext.h>
#include <linux/uaccess.h> #include <trace/events/skb.h> @@ -77,8 +78,6 @@ #include <linux/capability.h> #include <linux/user_namespace.h>
-#include "sock_destructor.h" - struct kmem_cache *skbuff_head_cache __ro_after_init; static struct kmem_cache *skbuff_fclone_cache __ro_after_init; int sysctl_max_skb_frags __read_mostly = MAX_SKB_FRAGS;