From: Jiri Pirko <jiri@resnulli.us>
To: Chenyuan Yang <chenyuan0y@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org, zzjas98@gmail.com
Subject: Re: [net/devlink] Question about possible CMD misuse in devlink_nl_port_new_doit()
Date: Mon, 18 Mar 2024 10:21:20 +0100 [thread overview]
Message-ID: <ZfgHkApgxX7DybHx@nanopsycho> (raw)
In-Reply-To: <ZfZcDxGV3tSy4qsV@cy-server>
Sun, Mar 17, 2024 at 03:57:19AM CET, chenyuan0y@gmail.com wrote:
>Dear Devlink Developers,
>
>We are curious whether the function `devlink_nl_port_new_doit()` might have a incorrect command value `DEVLINK_CMD_NEW`, which should be `DEVLINK_CMD_PORT_NEW`.
>
>The function is https://elixir.bootlin.com/linux/v6.8/source/net/devlink/port.c#L844
>and the relevant code is
>```
>int devlink_nl_port_new_doit(struct sk_buff *skb, struct genl_info *info)
>{
> ...
> err = devlink_nl_port_fill(msg, devlink_port, DEVLINK_CMD_NEW,
> info->snd_portid, info->snd_seq, 0, NULL);
> if (WARN_ON_ONCE(err))
> goto err_out_msg_free;
> ...
>}
>```
>
>In `devlink_nl_port_fill`, all other places use `DEVLINK_CMD_PORT_NEW` as the command value. However, in `devlink_nl_port_new_doit`, it uses `DEVLINK_CMD_NEW`. This might be a misuse, also according to https://lore.kernel.org/netdev/20240216113147.50797-1-jiri@resnulli.us/T/.
>
>Based on our understanding, a possible fix would be
>```
>- err = devlink_nl_port_fill(msg, devlink_port, DEVLINK_CMD_NEW,
>+ err = devlink_nl_port_fill(msg, devlink_port, DEVLINK_CMD_PORT_NEW,
>```
>
>Please kindly correct us if we missed any key information. Looking forward to your response!
You are correct, this is a bug. Thanks for report!
Here's the fix:
https://lore.kernel.org/netdev/20240318091908.2736542-1-jiri@resnulli.us/
next prev parent reply other threads:[~2024-03-18 9:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-17 2:57 [net/devlink] Question about possible CMD misuse in devlink_nl_port_new_doit() Chenyuan Yang
2024-03-18 9:21 ` Jiri Pirko [this message]
2024-03-18 19:29 ` Chenyuan Yang
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=ZfgHkApgxX7DybHx@nanopsycho \
--to=jiri@resnulli.us \
--cc=chenyuan0y@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zzjas98@gmail.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.