From d8fcb4c06b7d72d655d0d96dffe9b8f2bbe6a784 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 2 May 2024 07:47:00 +0000 Subject: [PATCH] Revert "mptcp: fix lockless access in subflow ULP diag" This reverts commit 71787c665d09a970b9280c285181d3a2d1bf3bb0 which is commit b8adb69a7d29c2d33eb327bca66476fb6066516b 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: I18ef204d3c165adca98146fa07d2fd25671d7b42 Signed-off-by: Greg Kroah-Hartman --- include/net/tcp.h | 2 +- net/mptcp/diag.c | 6 +----- net/tls/tls_main.c | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index e1ba0fb66ff9..c3d56b337f35 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -2289,7 +2289,7 @@ struct tcp_ulp_ops { /* cleanup ulp */ void (*release)(struct sock *sk); /* diagnostic */ - int (*get_info)(struct sock *sk, struct sk_buff *skb); + int (*get_info)(const struct sock *sk, struct sk_buff *skb); size_t (*get_info_size)(const struct sock *sk); /* clone ulp */ void (*clone)(const struct request_sock *req, struct sock *newsk, diff --git a/net/mptcp/diag.c b/net/mptcp/diag.c index e57c5f47f035..a536586742f2 100644 --- a/net/mptcp/diag.c +++ b/net/mptcp/diag.c @@ -13,19 +13,17 @@ #include #include "protocol.h" -static int subflow_get_info(struct sock *sk, struct sk_buff *skb) +static int subflow_get_info(const struct sock *sk, struct sk_buff *skb) { struct mptcp_subflow_context *sf; struct nlattr *start; u32 flags = 0; - bool slow; int err; start = nla_nest_start_noflag(skb, INET_ULP_INFO_MPTCP); if (!start) return -EMSGSIZE; - slow = lock_sock_fast(sk); rcu_read_lock(); sf = rcu_dereference(inet_csk(sk)->icsk_ulp_data); if (!sf) { @@ -71,13 +69,11 @@ static int subflow_get_info(struct sock *sk, struct sk_buff *skb) } rcu_read_unlock(); - unlock_sock_fast(sk, slow); nla_nest_end(skb, start); return 0; nla_failure: rcu_read_unlock(); - unlock_sock_fast(sk, slow); nla_nest_cancel(skb, start); return err; } diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 8267b37dfa8e..f2e7302a4d96 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -1092,7 +1092,7 @@ static u16 tls_user_config(struct tls_context *ctx, bool tx) return 0; } -static int tls_get_info(struct sock *sk, struct sk_buff *skb) +static int tls_get_info(const struct sock *sk, struct sk_buff *skb) { u16 version, cipher_type; struct tls_context *ctx;