netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: rtnl_newlink() cleanup on namespace change
Date: Wed, 11 Mar 2015 09:35:00 -0700	[thread overview]
Message-ID: <CAM_iQpU95fLZN6+DqAnA7BSf1JRKamaOfehYsORj8m+LTkM2SQ@mail.gmail.com> (raw)
In-Reply-To: <20150310.220011.1982964437618102167.davem@davemloft.net>

On Tue, Mar 10, 2015 at 7:00 PM, David Miller <davem@davemloft.net> wrote:
> From: Cong Wang <xiyou.wangcong@gmail.com>
> Date: Tue, 10 Mar 2015 16:44:06 -0700
>
>> On Tue, Mar 10, 2015 at 3:43 PM, David Miller <davem@davemloft.net> wrote:
>>>
>>> Cong, I was reviewing commit 7afb8886a05be68e376655539a064ec672de8a8e
>>> ("rtnetlink: call ->dellink on failure when ->newlink exists") during
>>> a stable backport and I noticed that the function, after the change
>>> you made, subsequently goes:
>>>
>>>                 if (link_net) {
>>>                         err = dev_change_net_namespace(dev, dest_net, ifname);
>>>                         if (err < 0)
>>>                                 unregister_netdevice(dev);
>>>                 }
>>>
>>> Isn't the potential ->dellink() unwinding necessary in this path too?
>>>
>>
>> Right, I wasn't aware of the link_net change.
>> Do you want me to send a fix?
>
> I took care of it, as follows:

Thanks, it looks good.

>
> ====================
> [PATCH] net: Handle unregister properly when netdev namespace change fails.
>
> If rtnl_newlink() fails on it's call to dev_change_net_namespace(), we
> have to make use of the ->dellink() method, if present, just like we
> do when rtnl_configure_link() fails.
>
> Fixes: 317f4810e45e ("rtnl: allow to create device with IFLA_LINK_NETNSID set")
> Signed-off-by: David S. Miller <davem@davemloft.net>

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

      reply	other threads:[~2015-03-11 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 22:43 rtnl_newlink() cleanup on namespace change David Miller
2015-03-10 23:44 ` Cong Wang
2015-03-11  2:00   ` David Miller
2015-03-11 16:35     ` Cong Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM_iQpU95fLZN6+DqAnA7BSf1JRKamaOfehYsORj8m+LTkM2SQ@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).