ipv6: Fix inet6_init() cleanup order
Subsystems (2)
PATCH 1/1 ipv6: Fix inet6_init() cleanup order
Commit 6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67
net: ipv6: Add IPv6 support to the ping socket
introduced a change in the cleanup logic of inet6_init and has a bug in that ipv6_packet_cleanup() may not be called. Fix the cleanup ordering and add __maybe_unused to pingv6_exit since it may not be called if CONFIG_SYSCTL is turned off.
--- net/ipv6/af_inet6.c | 4 ++-- net/ipv6/ping.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/ipv6/af_inet6.c +2 -2
@@ -958,10 +958,10 @@ out:#ifdef CONFIG_SYSCTL sysctl_fail: -ipv6_packet_cleanup (); +pingv6_exit ();#endif pingv6_fail: -pingv6_exit (); +ipv6_packet_cleanup (); ipv6_packet_fail:tcpv6_exit (); tcpv6_fail:
net/ipv6/ping.c +0 -0
@@ -263,7 +263,7 @@ int __init pingv6_init(void)/* This never gets called because it's not possible to unload the ipv6
module,
* but just in case.
*/
-void pingv6_exit(void)
+void __maybe_unused pingv6_exit(void)
{
pingv6_ops.ipv6_recv_error = dummy_ipv6_recv_error; pingv6_ops.ip6_datagram_recv_ctl = dummy_ip6_datagram_recv_ctl;
Signature · 1 line
1.8.4.2
Hi!
Quoted 24 lines · Vlad Yasevich
Commit
6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67
net: ipv6: Add IPv6 support to the ping socketintroduced a change in the cleanup logic of
inet6_initand has a bug in thatipv6_packet_cleanup()may not be called. Fix the cleanup ordering and add__maybe_unusedtopingv6_exitsince it may not be called ifCONFIG_SYSCTLis turned off.CC Hannes Frederic Sowa <[email protected]>CC Lorenzo Colitti <[email protected]>CC Fabio Estevam <[email protected]>Suggested-by Hannes Frederic Sowa <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>--- net/ipv6/af_inet6.c | 4 ++-- net/ipv6/ping.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)net/ipv6/af_inet6.c +0
-0@@ -958,10 +958,10 @@ out:#ifdef CONFIG_SYSCTL
net/ipv6/af_inet6.c out: · line 966
Quoted 10 lines
net/ipv6/af_inet6.c +2
-2sysctl_fail: -ipv6_packet_cleanup (); +pingv6_exit ();#endif pingv6_fail: -pingv6_exit (); +ipv6_packet_cleanup (); ipv6_packet_fail:tcpv6_exit (); tcpv6_fail:
Your patch seems corrupt here:
$ patch -p1 < .git/rebase-apply/patch patching file net/ipv6/af_inet6.c patch: **** malformed patch at line 22: diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
The logic here looks fine though.
Quoted 13 lines
net/ipv6/ping.c +1
-1@@ -263,7 +263,7 @@ int __init pingv6_init(void)/* This never gets called because it's not possible to unload the ipv6 module, * but just in case. */ -void pingv6_exit (void ) +void __maybe_unused pingv6_exit (void ) { pingv6_ops.ipv6_recv_error = dummy_ipv6_recv_error;
Quoted 1 line
pingv6_ops.ip6_datagram_recv_ctl =
dummy_ip6_datagram_recv_ctl;
We only would need __maybe_unused if the function which generates the warning is static in the same compilation unit. So this seems unneccessary.
Thanks,
Hannes