diff mbox series

[mptcp-next] mptcp: mark ops structures as ro_after_init

Message ID 20220209102933.20873-1-fw@strlen.de (mailing list archive)
State Accepted, archived
Commit 6072c8a8fe34b31a8fb5830c618a53a8587b8a56
Delegated to: Matthieu Baerts
Headers show
Series [mptcp-next] mptcp: mark ops structures as ro_after_init | expand

Checks

Context Check Description
matttbe/build success Build and static analysis OK
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
matttbe/KVM_Validation__normal warning Unstable: 1 failed test(s): selftest_mptcp_join
matttbe/KVM_Validation__debug success Success! ✅

Commit Message

Florian Westphal Feb. 9, 2022, 10:29 a.m. UTC
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(-)

Comments

Mat Martineau Feb. 9, 2022, 11:18 p.m. UTC | #1
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
Matthieu Baerts Feb. 10, 2022, 2:52 p.m. UTC | #2
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
diff mbox series

Patch

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)