From: Dan Carpenter <dan.carpenter@linaro.org>
To: Cong Wang <cong.wang@bytedance.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@amazon.com>,
Ido Schimmel <idosch@nvidia.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()
Date: Fri, 6 Dec 2024 15:32:52 +0300 [thread overview]
Message-ID: <a2d20cd4-387a-4475-887c-bb7d0e88e25a@stanley.mountain> (raw)
If rtnl_get_peer_net() fails, then propagate the error code. Don't
return success.
Fixes: 48327566769a ("rtnetlink: fix double call of rtnl_link_get_net_ifla()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
net/core/rtnetlink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ab5f201bf0ab..ebcfc2debf1a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3972,8 +3972,10 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
if (ops->peer_type) {
peer_net = rtnl_get_peer_net(ops, data, extack);
- if (IS_ERR(peer_net))
+ if (IS_ERR(peer_net)) {
+ ret = PTR_ERR(peer_net);
goto put_ops;
+ }
if (peer_net)
rtnl_nets_add(&rtnl_nets, peer_net);
}
--
2.45.2
next reply other threads:[~2024-12-06 12:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 12:32 Dan Carpenter [this message]
2024-12-06 23:27 ` [PATCH net-next] rtnetlink: fix error code in rtnl_newlink() Kuniyuki Iwashima
2024-12-07 17:07 ` Dan Carpenter
2024-12-08 2:30 ` patchwork-bot+netdevbpf
2024-12-10 5:58 ` Cong Wang
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=a2d20cd4-387a-4475-887c-bb7d0e88e25a@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=cong.wang@bytedance.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--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