From: Alexander Duyck Date: Tue, 15 Nov 2016 10:46:12 +0000 (-0500) Subject: ipv4: Fix memory leak in exception case for splitting tries X-Git-Tag: v4.8.14~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd8a6c0e95bf59003c131f442e7eafded396627e;p=thirdparty%2Fkernel%2Fstable.git ipv4: Fix memory leak in exception case for splitting tries [ Upstream commit 3114cdfe66c156345b0ae34e2990472f277e0c1b ] Fix a small memory leak that can occur where we leak a fib_alias in the event of us not being able to insert it into the local table. Fixes: 0ddcf43d5d4a0 ("ipv4: FIB Local/MAIN table collapse") Reported-by: Eric Dumazet Signed-off-by: Alexander Duyck Acked-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 7ef703102dcaa..79ff363d6a7a5 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1713,8 +1713,10 @@ struct fib_table *fib_trie_unmerge(struct fib_table *oldtb) local_l = fib_find_node(lt, &local_tp, l->key); if (fib_insert_alias(lt, local_tp, local_l, new_fa, - NULL, l->key)) + NULL, l->key)) { + kmem_cache_free(fn_alias_kmem, new_fa); goto out; + } } /* stop loop if key wrapped back to 0 */