From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <christophe.jaillet@wanadoo.fr>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <horms@kernel.org>,
<kernel-janitors@vger.kernel.org>, <kuba@kernel.org>,
<kuniyu@amazon.com>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>
Subject: Re: [PATCH] rtnetlink: Fix an error handling path in rtnl_newlink()
Date: Sat, 26 Oct 2024 12:12:55 -0700 [thread overview]
Message-ID: <20241026191255.15528-1-kuniyu@amazon.com> (raw)
In-Reply-To: <eca90eeb4d9e9a0545772b68aeaab883d9fe2279.1729952228.git.christophe.jaillet@wanadoo.fr>
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat, 26 Oct 2024 16:17:44 +0200
> When some code has been moved in the commit in Fixes, some "return err;"
> have correctly been changed in goto <some_where_in_the_error_handling_path>
> but this one was missed.
>
> Should "ops->maxtype > RTNL_MAX_TYPE" happen, then some resources would
> leak.
>
> Go through the error handling path to fix these leaks.
>
> Fixes: 0d3008d1a9ae ("rtnetlink: Move ops->validate to rtnl_newlink().")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Thanks for catching!
> ---
> Compile tested only
> ---
> net/core/rtnetlink.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 194a81e5f608..e269fae2b579 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -3829,8 +3829,10 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
> }
>
> if (ops) {
> - if (ops->maxtype > RTNL_MAX_TYPE)
> - return -EINVAL;
> + if (ops->maxtype > RTNL_MAX_TYPE) {
> + ret = -EINVAL;
> + goto put_ops;
> + }
>
> if (ops->maxtype && linkinfo[IFLA_INFO_DATA]) {
> ret = nla_parse_nested_deprecated(tbs->attr, ops->maxtype,
> --
> 2.47.0
next prev parent reply other threads:[~2024-10-26 19:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 14:17 Christophe JAILLET
2024-10-26 19:12 ` Kuniyuki Iwashima [this message]
2024-10-31 1:30 ` patchwork-bot+netdevbpf
2024-10-26 14:28 Christophe JAILLET
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=20241026191255.15528-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®