public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()
@ 2024-12-06 12:32 Dan Carpenter
  2024-12-06 23:27 ` Kuniyuki Iwashima
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dan Carpenter @ 2024-12-06 12:32 UTC (permalink / raw)
  To: Cong Wang
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Kuniyuki Iwashima, Ido Schimmel, netdev,
	linux-kernel, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()
  2024-12-06 12:32 [PATCH net-next] rtnetlink: fix error code in rtnl_newlink() Dan Carpenter
@ 2024-12-06 23:27 ` Kuniyuki Iwashima
  2024-12-07 17:07   ` Dan Carpenter
  2024-12-08  2:30 ` patchwork-bot+netdevbpf
  2024-12-10  5:58 ` Cong Wang
  2 siblings, 1 reply; 5+ messages in thread
From: Kuniyuki Iwashima @ 2024-12-06 23:27 UTC (permalink / raw)
  To: dan.carpenter
  Cc: cong.wang, davem, edumazet, horms, idosch, kernel-janitors, kuba,
	kuniyu, linux-kernel, netdev, pabeni

> [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()

This should be tagged for net.git.

Otherwise looks good to me.


> 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>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>

Thanks!

> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()
  2024-12-06 23:27 ` Kuniyuki Iwashima
@ 2024-12-07 17:07   ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2024-12-07 17:07 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: cong.wang, davem, edumazet, horms, idosch, kernel-janitors, kuba,
	linux-kernel, netdev, pabeni

On Sat, Dec 07, 2024 at 08:27:31AM +0900, Kuniyuki Iwashima wrote:
> > [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()
> 
> This should be tagged for net.git.
> 

Sorry about that.  It was a mistake in my scripting.  I'll fix it.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()
  2024-12-06 12:32 [PATCH net-next] rtnetlink: fix error code in rtnl_newlink() Dan Carpenter
  2024-12-06 23:27 ` Kuniyuki Iwashima
@ 2024-12-08  2:30 ` patchwork-bot+netdevbpf
  2024-12-10  5:58 ` Cong Wang
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-08  2:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: cong.wang, davem, edumazet, kuba, pabeni, horms, kuniyu, idosch,
	netdev, linux-kernel, kernel-janitors

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 6 Dec 2024 15:32:52 +0300 you wrote:
> 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(-)

Here is the summary with links:
  - [net-next] rtnetlink: fix error code in rtnl_newlink()
    https://git.kernel.org/netdev/net/c/09310cfd4ea5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] rtnetlink: fix error code in rtnl_newlink()
  2024-12-06 12:32 [PATCH net-next] rtnetlink: fix error code in rtnl_newlink() Dan Carpenter
  2024-12-06 23:27 ` Kuniyuki Iwashima
  2024-12-08  2:30 ` patchwork-bot+netdevbpf
@ 2024-12-10  5:58 ` Cong Wang
  2 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2024-12-10  5:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Cong Wang, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Kuniyuki Iwashima, Ido Schimmel,
	netdev, linux-kernel, kernel-janitors

On Fri, Dec 06, 2024 at 03:32:52PM +0300, Dan Carpenter wrote:
> 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>

Oops, how could I miss this even when I mentioned propagation in my commit
message... :-/

Thanks for catching it quickly!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-10  5:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 12:32 [PATCH net-next] rtnetlink: fix error code in rtnl_newlink() Dan Carpenter
2024-12-06 23:27 ` Kuniyuki Iwashima
2024-12-07 17:07   ` Dan Carpenter
2024-12-08  2:30 ` patchwork-bot+netdevbpf
2024-12-10  5:58 ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox