net/mptcp/subflow.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
These structures are initialised from the init hooks, so we can't make
them 'const'. But no writes occur afterwards, so we can use ro_after_init.
Also, remove bogus EXPORT_SYMBOL, the only access comes from ip
stack, not from kernel modules.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/mptcp/subflow.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index d4b4d285ffc1..289df4fd0a73 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -482,8 +482,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
}
struct request_sock_ops mptcp_subflow_request_sock_ops;
-EXPORT_SYMBOL_GPL(mptcp_subflow_request_sock_ops);
-static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops;
+static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops __ro_after_init;
static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb)
{
@@ -504,9 +503,9 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb)
}
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
-static struct tcp_request_sock_ops subflow_request_sock_ipv6_ops;
-static struct inet_connection_sock_af_ops subflow_v6_specific;
-static struct inet_connection_sock_af_ops subflow_v6m_specific;
+static struct tcp_request_sock_ops subflow_request_sock_ipv6_ops __ro_after_init;
+static struct inet_connection_sock_af_ops subflow_v6_specific __ro_after_init;
+static struct inet_connection_sock_af_ops subflow_v6m_specific __ro_after_init;
static struct proto tcpv6_prot_override;
static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb)
--
2.34.1
Hi Florian, Mat, On 09/02/2022 11:29, Florian Westphal wrote: > These structures are initialised from the init hooks, so we can't make > them 'const'. But no writes occur afterwards, so we can use ro_after_init. > > Also, remove bogus EXPORT_SYMBOL, the only access comes from ip > stack, not from kernel modules. Thank you for the patch and the review! Now in our tree (feat. for net-next) with Mat's RvB tag: - 6072c8a8fe34: mptcp: mark ops structures as ro_after_init - Results: bfba92ddd537..af8e6fcc9de1 Builds and tests are now in progress: https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220210T145230 https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export Cheers, Matt -- Tessares | Belgium | Hybrid Access Solutions www.tessares.net
On Wed, 9 Feb 2022, Florian Westphal wrote:
> These structures are initialised from the init hooks, so we can't make
> them 'const'. But no writes occur afterwards, so we can use ro_after_init.
>
> Also, remove bogus EXPORT_SYMBOL, the only access comes from ip
> stack, not from kernel modules.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> net/mptcp/subflow.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
Looks good to me, thanks Florian.
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
>
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index d4b4d285ffc1..289df4fd0a73 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -482,8 +482,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
> }
>
> struct request_sock_ops mptcp_subflow_request_sock_ops;
> -EXPORT_SYMBOL_GPL(mptcp_subflow_request_sock_ops);
> -static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops;
> +static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops __ro_after_init;
>
> static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb)
> {
> @@ -504,9 +503,9 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb)
> }
>
> #if IS_ENABLED(CONFIG_MPTCP_IPV6)
> -static struct tcp_request_sock_ops subflow_request_sock_ipv6_ops;
> -static struct inet_connection_sock_af_ops subflow_v6_specific;
> -static struct inet_connection_sock_af_ops subflow_v6m_specific;
> +static struct tcp_request_sock_ops subflow_request_sock_ipv6_ops __ro_after_init;
> +static struct inet_connection_sock_af_ops subflow_v6_specific __ro_after_init;
> +static struct inet_connection_sock_af_ops subflow_v6m_specific __ro_after_init;
> static struct proto tcpv6_prot_override;
>
> static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb)
> --
> 2.34.1
>
>
>
--
Mat Martineau
Intel
© 2016 - 2026 Red Hat, Inc.