Skip to content

Commit cd77e75

Browse files
Dan Carpenterummakynes
authored andcommitted
netfilter: nf_tables: fix memory leak in nf_tables_parse_netdev_hooks()
Syzbot detected a leak in nf_tables_parse_netdev_hooks(). If the hook already exists, then the error handling doesn't free the newest "hook". Reported-by: [email protected] Fixes: b75a3e8 ("netfilter: nf_tables: allow netdevice to be used only once per flowtable") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 9332d27 commit cd77e75

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,7 @@ static int nf_tables_parse_netdev_hooks(struct net *net,
16801680
goto err_hook;
16811681
}
16821682
if (nft_hook_list_find(hook_list, hook)) {
1683+
kfree(hook);
16831684
err = -EEXIST;
16841685
goto err_hook;
16851686
}

0 commit comments

Comments
 (0)