From: Jakub Kicinski <kuba@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, przemyslaw.kitszel@intel.com,
daniel@iogearbox.net, opurdila@ixiacom.com
Subject: Re: [PATCH net v2 1/5] net: fix ifname in netlink ntf during netns move
Date: Wed, 18 Oct 2023 08:13:41 -0700 [thread overview]
Message-ID: <20231018081341.66bf393b@kernel.org> (raw)
In-Reply-To: <ZS+FehME4fC4b7w4@nanopsycho>
On Wed, 18 Oct 2023 09:12:58 +0200 Jiri Pirko wrote:
> >+static int dev_prep_valid_name(struct net *net, struct net_device *dev,
> >+ const char *want_name, char *out_name)
> >+{
> >+ int ret;
> >+
> >+ if (!dev_valid_name(want_name))
> >+ return -EINVAL;
> >+
> >+ if (strchr(want_name, '%')) {
> >+ ret = __dev_alloc_name(net, want_name, out_name);
> >+ return ret < 0 ? ret : 0;
> >+ } else if (netdev_name_in_use(net, want_name)) {
> >+ return -EEXIST;
> >+ } else if (out_name != want_name) {
>
> How this can happen?
> You call dev_prep_valid_name() twice:
> ret = dev_prep_valid_name(net, dev, name, buf);
> err = dev_prep_valid_name(net, dev, pat, new_name);
>
> Both buf and new_name are on stack tmp variables.
I'm moving this code 1-to-1. I have patches queued up to clean all
this up in net-next. Please let me know if you see any bugs.
next prev parent reply other threads:[~2023-10-18 15:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 1:38 [PATCH net v2 0/5] net: fix bugs in device netns-move and rename Jakub Kicinski
2023-10-18 1:38 ` [PATCH net v2 1/5] net: fix ifname in netlink ntf during netns move Jakub Kicinski
2023-10-18 7:12 ` Jiri Pirko
2023-10-18 15:13 ` Jakub Kicinski [this message]
2023-10-19 13:42 ` Jiri Pirko
2023-10-18 1:38 ` [PATCH net v2 2/5] net: check for altname conflicts when changing netdev's netns Jakub Kicinski
2023-10-18 1:38 ` [PATCH net v2 3/5] net: avoid UAF on deleted altname Jakub Kicinski
2023-10-18 1:38 ` [PATCH net v2 4/5] net: move altnames together with the netdevice Jakub Kicinski
2023-10-18 1:38 ` [PATCH net v2 5/5] selftests: net: add very basic test for netdev names and namespaces Jakub Kicinski
2023-10-18 20:30 ` Przemek Kitszel
2023-10-19 14:00 ` [PATCH net v2 0/5] net: fix bugs in device netns-move and rename patchwork-bot+netdevbpf
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=20231018081341.66bf393b@kernel.org \
--to=kuba@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=opurdila@ixiacom.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.