mptcp: mark ops structures as ro_after_init
Subsystems (2)
PATCH 1/1 mptcp: mark ops structures as ro_after_init
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.
--- net/mptcp/subflow.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/mptcp/subflow.c +4 -5
@@ -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)
Signature · 1 line
2.34.1
Quoted 10 lines · Florian Westphal
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 <[email protected]>---
net/mptcp/subflow.c| 9 ++++-----1 file changed, 4 insertions(+), 5 deletions(-)
Looks good to me, thanks Florian.
Quoted 33 lines
net/mptcp/subflow.c +4
-5@@ -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)Signature · 1 line
2.34.1
--
Mat Martineau
Intel
Hi Florian, Mat,
Quoted 5 lines · Florian Westphal
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
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net