public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <johannes@sipsolutions.net>
Cc: <i.abramov@mt-integration.ru>, <kuniyu@amazon.com>,
	<linux-kernel@vger.kernel.org>, <linux-wireless@vger.kernel.org>,
	<lvc-project@linuxtesting.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] cfg80211: Restore initial state on failed device_rename() in cfg80211_switch_netns()
Date: Wed, 23 Apr 2025 11:16:40 -0700	[thread overview]
Message-ID: <20250423181714.24628-1-kuniyu@amazon.com> (raw)
In-Reply-To: <4a91f731c49d3449632f19dcf4a1a8f5a9eb847b.camel@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Wed, 23 Apr 2025 17:44:45 +0200
> On Mon, 2025-04-07 at 15:53 +0300, Ivan Abramov wrote:
> > Currently, the return value of device_rename() is not acted upon.
> > 
> > To avoid an inconsistent state in case of failure, roll back the changes
> > made before the device_rename() call.
> 
> This kind of seems complicated for something that ought to not happen
> ...
> 
> And also (+netdev), what do we do in case this is called from
> cfg80211_pernet_exit() - leak the whole network namespace because we
> couldn't allocate memory for the name? That seems counterproductive.

default_device_exit_net() does BUG() in such a case, it doens't
assume -ENOMEM as we are freeing memory in the netns dismantle.


static void __net_exit default_device_exit_net(struct net *net)
{
...
	for_each_netdev_safe(net, dev, aux) {
...
		err = dev_change_net_namespace(dev, &init_net, fb_name);
		if (err) {
			pr_emerg("%s: failed to move %s to init_net: %d\n",
				 __func__, dev->name, err);
			BUG();
		}
	}
}

  reply	other threads:[~2025-04-23 18:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 12:53 [PATCH v2 0/3] Avoid calling WARN_ON() on allocation failure in cfg80211_switch_netns() Ivan Abramov
2025-04-07 12:53 ` [PATCH v2 1/3] cfg80211: Restore initial state on failed device_rename() " Ivan Abramov
2025-04-23 15:44   ` Johannes Berg
2025-04-23 18:16     ` Kuniyuki Iwashima [this message]
2025-04-07 12:53 ` [PATCH v2 2/3] cfg80211: Avoid calling WARN_ON() on -ENOMEM " Ivan Abramov
2025-04-07 12:53 ` [PATCH v2 3/3] cfg80211: Remove WARN_ON() in cfg80211_pernet_exit() Ivan Abramov
2025-04-07 17:29 ` [PATCH v2 0/3] Avoid calling WARN_ON() on allocation failure in cfg80211_switch_netns() Kuniyuki Iwashima

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=20250423181714.24628-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=i.abramov@mt-integration.ru \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --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