Skip to content

Commit

Permalink
netfilter: nftables: Fix a memleak from userdata error path in new ob…
Browse files Browse the repository at this point in the history
…jects

[ Upstream commit 85dfd81 ]

Release object name if userdata allocation fails.

Fixes: b131c96 ("netfilter: nf_tables: add userdata support for nft_object")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
ummakynes authored and gregkh committed May 19, 2021
1 parent 403ccad commit 2c784a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nf_tables_api.c
Expand Up @@ -6015,9 +6015,9 @@ static int nf_tables_newobj(struct net *net, struct sock *nlsk,
INIT_LIST_HEAD(&obj->list);
return err;
err_trans:
kfree(obj->key.name);
err_userdata:
kfree(obj->udata);
err_userdata:
kfree(obj->key.name);
err_strdup:
if (obj->ops->destroy)
obj->ops->destroy(&ctx, obj);
Expand Down

0 comments on commit 2c784a5

Please sign in to comment.