[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231018081341.66bf393b@kernel.org>
Date: Wed, 18 Oct 2023 08:13:41 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jiri Pirko <jiri@...nulli.us>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, przemyslaw.kitszel@...el.com, daniel@...earbox.net,
opurdila@...acom.com
Subject: Re: [PATCH net v2 1/5] net: fix ifname in netlink ntf during netns
move
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.
Powered by blists - more mailing lists