[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+HUmGhUqXn35x6Nnhcrk+WH8PuiaxwsrZNy-NsJ94wybCukGA@mail.gmail.com>
Date: Mon, 18 Apr 2016 13:10:51 -0700
From: Francesco Ruggeri <fruggeri@...sta.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Mahesh Bandewar <maheshb@...gle.com>
Subject: Re: [PATCH net-next] macvlan: fix failure during registration
On Mon, Apr 18, 2016 at 11:48 AM, Eric W. Biederman
<ebiederm@...ssion.com> wrote:
>
> These interactions all seem a little bit funny. At a quick skim it
> would make more sense to increment the port count in macvlan_init,
> and completely remove the need to mess with port counts anywhere except
> macvlan_init and macvlan_uninit.
Thanks Eric, let me try that.
>
> If for some reason that can't be done the code can easily look at
> dev->reg_state. If dev->reg_state == NETREG_UNITIALIZED it should
> be exactly the same as your new flag being set.
>
I am not sure that in macvlan_uninit one can tell whether it is being
invoked in the context of a failed register_netdevice (if that is what
you meant).
In case of register_netdevice failing in
call_netdevice_notifiers(NETDEV_REGISTER) the call sequence is:
macvlan_common_newlink
register_netdevice
call_netdevice_notifiers(NETDEV_REGISTER, dev) (<== fail here)
rollback_registered(dev);
rollback_registered_many
dev->reg_state = NETREG_UNREGISTERING
dev->netdev_ops->ndo_uninit(dev)
dev->reg_state = NETREG_UNREGISTERED;
Francesco
Powered by blists - more mailing lists