summaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorZiyang Xuan <william.xuanziyang@huawei.com>2022-11-20 10:28:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-02 19:40:01 +0300
commitaeebb074997251c150d042a33a8673bfea53c247 (patch)
tree9779705a2d68fee89ae663b5a1c68d46644a940a /net/ipv4
parentc0af4d005a260a5f93b5784d6dc26e2cd2ef18dd (diff)
downloadlinux-aeebb074997251c150d042a33a8673bfea53c247.tar.xz
ipv4: Fix error return code in fib_table_insert()
[ Upstream commit 568fe84940ac0e4e0b2cd7751b8b4911f7b9c215 ] 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 <william.xuanziyang@huawei.com> Link: https://lore.kernel.org/r/20221120072838.2167047-1-william.xuanziyang@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_trie.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index a28f525e2c47..d11fb16234a6 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1331,8 +1331,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) {