LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH 2/2] IPVS: make failure of netns init more stable

To: Hans Schillstrom <hans.schillstrom@xxxxxxxxxxxx>
Subject: Re: [PATCH 2/2] IPVS: make failure of netns init more stable
Cc: "horms@xxxxxxxxxxxx" <horms@xxxxxxxxxxxx>, "wensong@xxxxxxxxxxxx" <wensong@xxxxxxxxxxxx>, "lvs-devel@xxxxxxxxxxxxxxx" <lvs-devel@xxxxxxxxxxxxxxx>, "netdev@xxxxxxxxxxxxxxx" <netdev@xxxxxxxxxxxxxxx>, "netfilter-devel@xxxxxxxxxxxxxxx" <netfilter-devel@xxxxxxxxxxxxxxx>, "hans@xxxxxxxxxxxxxxx" <hans@xxxxxxxxxxxxxxx>
From: Julian Anastasov <ja@xxxxxx>
Date: Mon, 16 Apr 2012 20:31:40 +0300 (EEST)
        Hello,

On Mon, 16 Apr 2012, Hans Schillstrom wrote:

> >     But I see some inconsistency in net/core/net_namespace.c:
> > __register_pernet_operations when CONFIG_NET_NS is enabled
> > does not call ops_free after failed ops_init while when
> > CONFIG_NET_NS is not enabled ops_free is called. The 
> > problem is that we leak the ops->size data allocated for the
> > failed net. I think, the fix should be ops_init to free the data.
> 
> Are you sure ?
> In my code it does... 
> 
> static int __register_pernet_operations(struct list_head *list,
>                                       struct pernet_operations *ops)
> at line 417
> ..
>               for_each_net(net) {
>                       error = ops_init(ops, net);
>                       if (error)
>                               goto out_undo;

        There is line here that registers current net for
cleanup only after ops_init success:

        list_add_tail(&net->exit_list, &net_exit_list);

        If ops_init fails for first net then net_exit_list will
be empty.

> ...
> line 426
> out_undo:
>       /* If I have an error cleanup all namespaces I initialized */
>       list_del(&ops->list);
>       ops_exit_list(ops, &net_exit_list);
>       ops_free_list(ops, &net_exit_list);
>       return error;
> }

Regards

--
Julian Anastasov <ja@xxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>