[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHA+R7OTFAc=1D=WRxLNuqScBJ+wD-wc-qxtNaFxSji_kRi1PA@mail.gmail.com>
Date: Tue, 30 Dec 2014 12:33:41 -0800
From: Cong Wang <cwang@...pensource.com>
To: Stephen Hemminger <shemming@...cade.com>
Cc: David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net] tunnel: support propagating lower device state
On Sat, Dec 27, 2014 at 9:59 AM, Stephen Hemminger <shemming@...cade.com> wrote:
> @@ -982,8 +1045,17 @@ int ip_tunnel_init_net(struct net *net,
> for (i = 0; i < IP_TNL_HASH_SIZE; i++)
> INIT_HLIST_HEAD(&itn->tunnels[i]);
>
> + itn->lower_dev = kcalloc(NETDEV_HASHENTRIES, sizeof(struct hlist_head),
> + GFP_KERNEL);
> + if (!itn->lower_dev) {
> + kfree(itn->tunnels);
> + return -ENOMEM;
> + }
> +
> if (!ops) {
> itn->fb_tunnel_dev = NULL;
> + kfree(itn->tunnels);
> + kfree(itn->lower_dev);
> return 0;
> }
>
> @@ -1003,7 +1075,12 @@ int ip_tunnel_init_net(struct net *net,
> }
> rtnl_unlock();
>
> - return PTR_ERR_OR_ZERO(itn->fb_tunnel_dev);
> + if (IS_ERR(itn->fb_tunnel_dev)) {
> + kfree(itn->tunnels);
> + return PTR_ERR(itn->fb_tunnel_dev);
> + }
> + return 0;
> +
> }
Are you sure we really need to free itn->tunnels on
failure path? It is not allocated inside ip_tunnel_init_net()
anyway.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists