From 8806a26646aa98a4ea48ecfe7995925685a52e8e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 15 Jan 2024 11:37:40 +0000 Subject: [PATCH] Revert "udp: move udp->no_check6_rx to udp->udp_flags" This reverts commit a01cff15ccdc3b71b217f8776a84f3c5e136ea0b which is commit bcbc1b1de884647aa0318bf74eb7f293d72a1e40 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ie41641266fcb642846b6af863e66b387b67f1a6a Signed-off-by: Greg Kroah-Hartman --- include/linux/udp.h | 10 +++++----- net/ipv4/udp.c | 4 ++-- net/ipv6/udp.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/udp.h b/include/linux/udp.h index e6cd46e2b083..b5ca5760ae34 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -33,7 +33,6 @@ static inline u32 udp_hashfn(const struct net *net, u32 num, u32 mask) enum { UDP_FLAGS_CORK, /* Cork is required */ UDP_FLAGS_NO_CHECK6_TX, /* Send zero UDP6 checksums on TX? */ - UDP_FLAGS_NO_CHECK6_RX, /* Allow zero UDP6 checksums on RX? */ }; struct udp_sock { @@ -47,7 +46,8 @@ struct udp_sock { int pending; /* Any pending frames ? */ __u8 encap_type; /* Is this an Encapsulation socket? */ - unsigned char encap_enabled:1, /* This socket enabled encap + unsigned char no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */ + encap_enabled:1, /* This socket enabled encap * processing; UDP tunnels and * different encapsulation layer set * this @@ -117,7 +117,7 @@ static inline void udp_set_no_check6_tx(struct sock *sk, bool val) static inline void udp_set_no_check6_rx(struct sock *sk, bool val) { - udp_assign_bit(NO_CHECK6_RX, sk, val); + udp_sk(sk)->no_check6_rx = val; } static inline bool udp_get_no_check6_tx(const struct sock *sk) @@ -125,9 +125,9 @@ static inline bool udp_get_no_check6_tx(const struct sock *sk) return udp_test_bit(NO_CHECK6_TX, sk); } -static inline bool udp_get_no_check6_rx(const struct sock *sk) +static inline bool udp_get_no_check6_rx(struct sock *sk) { - return udp_test_bit(NO_CHECK6_RX, sk); + return udp_sk(sk)->no_check6_rx; } static inline void udp_cmsg_recv(struct msghdr *msg, struct sock *sk, diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 01e74919885a..513035e83a82 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2715,7 +2715,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, break; case UDP_NO_CHECK6_RX: - udp_set_no_check6_rx(sk, valbool); + up->no_check6_rx = valbool; break; case UDP_SEGMENT: @@ -2812,7 +2812,7 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, break; case UDP_NO_CHECK6_RX: - val = udp_get_no_check6_rx(sk); + val = up->no_check6_rx; break; case UDP_SEGMENT: diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index ae4f7f983f95..c6e20293c521 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -882,7 +882,7 @@ start_lookup: /* If zero checksum and no_check is not on for * the socket then skip it. */ - if (!uh->check && !udp_get_no_check6_rx(sk)) + if (!uh->check && !udp_sk(sk)->no_check6_rx) continue; if (!first) { first = sk; @@ -1000,7 +1000,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) udp6_sk_rx_dst_set(sk, dst); - if (!uh->check && !udp_get_no_check6_rx(sk)) { + if (!uh->check && !udp_sk(sk)->no_check6_rx) { if (refcounted) sock_put(sk); goto report_csum_error; @@ -1022,7 +1022,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, /* Unicast */ sk = __udp6_lib_lookup_skb(skb, uh->source, uh->dest, udptable); if (sk) { - if (!uh->check && !udp_get_no_check6_rx(sk)) + if (!uh->check && !udp_sk(sk)->no_check6_rx) goto report_csum_error; return udp6_unicast_rcv_skb(sk, skb, uh); }