diff mbox

ipv6: delete protocol when cleanup

Message ID 546B20F8.6010806@cn.fujitsu.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Duan Jiong Nov. 18, 2014, 10:35 a.m. UTC
pim6_protocol was added when initiation, but it not deleted.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/ip6mr.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Cong Wang Nov. 18, 2014, 6:56 p.m. UTC | #1
On Tue, Nov 18, 2014 at 2:35 AM, Duan Jiong <duanj.fnst@cn.fujitsu.com> wrote:
>
> pim6_protocol was added when initiation, but it not deleted.
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> ---
>  net/ipv6/ip6mr.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
> index 0171f08..6dcdecd 100644
> --- a/net/ipv6/ip6mr.c
> +++ b/net/ipv6/ip6mr.c
> @@ -1439,6 +1439,9 @@ reg_pernet_fail:
>
>  void ip6_mr_cleanup(void)
>  {
> +#ifdef CONFIG_IPV6_PIMSM_V2
> +       inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
> +#endif
>         unregister_netdevice_notifier(&ip6_mr_notifier);
>         unregister_pernet_subsys(&ip6mr_net_ops);
>         kmem_cache_destroy(mrt_cachep);


Looks like rtnl_unregister() is missing as well.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Nov. 18, 2014, 7:14 p.m. UTC | #2
On Tue, 2014-11-18 at 10:56 -0800, Cong Wang wrote:
> On Tue, Nov 18, 2014 at 2:35 AM, Duan Jiong <duanj.fnst@cn.fujitsu.com> wrote:
> >
> > pim6_protocol was added when initiation, but it not deleted.
> >
> > Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>

...

> Looks like rtnl_unregister() is missing as well.

Is it really worth bothering ?

May I remind you we took the decision one year ago to not bother about
removing ipv6 module.

commit 8ce440610357b77587433d0df647cea69a6890a8
Author: Cong Wang <amwang@redhat.com>
Date:   Sat Sep 21 11:12:21 2013 +0800

    ipv6: do not allow ipv6 module to be removed
    
    There was some bug report on ipv6 module removal path before.
    Also, as Stephen pointed out, after vxlan module gets ipv6 support,
    the ipv6 stub it used is not safe against this module removal either.
    So, let's just remove inet6_exit() so that ipv6 module will not be
    able to be unloaded.
    
    Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
    Cc: Stephen Hemminger <stephen@networkplumber.org>
    Cc: David S. Miller <davem@davemloft.net>
    Signed-off-by: Cong Wang <amwang@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Cong Wang Nov. 18, 2014, 7:46 p.m. UTC | #3
On Tue, Nov 18, 2014 at 11:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2014-11-18 at 10:56 -0800, Cong Wang wrote:
>> On Tue, Nov 18, 2014 at 2:35 AM, Duan Jiong <duanj.fnst@cn.fujitsu.com> wrote:
>> >
>> > pim6_protocol was added when initiation, but it not deleted.
>> >
>> > Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>
> ...
>
>> Looks like rtnl_unregister() is missing as well.
>
> Is it really worth bothering ?
>
> May I remind you we took the decision one year ago to not bother about
> removing ipv6 module.
>

It is still called in error path of init, so just for completeness.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Duan Jiong Nov. 19, 2014, 1:10 a.m. UTC | #4
On 11/19/2014 02:56 AM, Cong Wang wrote:
> On Tue, Nov 18, 2014 at 2:35 AM, Duan Jiong <duanj.fnst@cn.fujitsu.com> wrote:
>>
>> pim6_protocol was added when initiation, but it not deleted.
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>> ---
>>  net/ipv6/ip6mr.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
>> index 0171f08..6dcdecd 100644
>> --- a/net/ipv6/ip6mr.c
>> +++ b/net/ipv6/ip6mr.c
>> @@ -1439,6 +1439,9 @@ reg_pernet_fail:
>>
>>  void ip6_mr_cleanup(void)
>>  {
>> +#ifdef CONFIG_IPV6_PIMSM_V2
>> +       inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
>> +#endif
>>         unregister_netdevice_notifier(&ip6_mr_notifier);
>>         unregister_pernet_subsys(&ip6mr_net_ops);
>>         kmem_cache_destroy(mrt_cachep);
> 
> 
> Looks like rtnl_unregister() is missing as well.
> 

Thanks for pointing this, i will send v2.

Thanks,
  Duan

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 0171f08..6dcdecd 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1439,6 +1439,9 @@  reg_pernet_fail:
 
 void ip6_mr_cleanup(void)
 {
+#ifdef CONFIG_IPV6_PIMSM_V2
+	inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
+#endif
 	unregister_netdevice_notifier(&ip6_mr_notifier);
 	unregister_pernet_subsys(&ip6mr_net_ops);
 	kmem_cache_destroy(mrt_cachep);