[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZTEyLbSgJaZcHnja@nanopsycho>
Date: Thu, 19 Oct 2023 15:42:05 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Jakub Kicinski <kuba@...nel.org>
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
Wed, Oct 18, 2023 at 05:13:41PM CEST, kuba@...nel.org wrote:
>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.
Okay, fair enough. It just looks odd, but I get it for "net".
Reviewed-by: Jiri Pirko <jiri@...dia.com>
Powered by blists - more mailing lists