2022-11-20 08:01:34

by Ziyang Xuan (William)

[permalink] [raw]
Subject: [PATCH net] ipv4: Fix error return code in fib_table_insert()

In fib_table_insert(), if the alias was already inserted, but node not
exist, the error code should be set before return from error handling path.

Fixes: a6c76c17df02 ("ipv4: Notify route after insertion to the routing table")
Signed-off-by: Ziyang Xuan <[email protected]>
---
net/ipv4/fib_trie.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 452ff177e4da..f26d5ac117d6 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1381,8 +1381,10 @@ int fib_table_insert(struct net *net, struct fib_table *tb,

/* The alias was already inserted, so the node must exist. */
l = l ? l : fib_find_node(t, &tp, key);
- if (WARN_ON_ONCE(!l))
+ if (WARN_ON_ONCE(!l)) {
+ err = -ENOENT;
goto out_free_new_fa;
+ }

if (fib_find_alias(&l->leaf, new_fa->fa_slen, 0, 0, tb->tb_id, true) ==
new_fa) {
--
2.25.1



2022-11-23 05:31:37

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net] ipv4: Fix error return code in fib_table_insert()

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

On Sun, 20 Nov 2022 15:28:38 +0800 you wrote:
> In fib_table_insert(), if the alias was already inserted, but node not
> exist, the error code should be set before return from error handling path.
>
> Fixes: a6c76c17df02 ("ipv4: Notify route after insertion to the routing table")
> Signed-off-by: Ziyang Xuan <[email protected]>
> ---
> net/ipv4/fib_trie.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)

Here is the summary with links:
- [net] ipv4: Fix error return code in fib_table_insert()
https://git.kernel.org/netdev/net/c/568fe84940ac

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