diff options
author | Florian Westphal <fw@strlen.de> | 2018-04-10 09:00:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-22 18:53:58 +0200 |
commit | 321bc88ec098845ec93d047858a010d41be26ed9 (patch) | |
tree | 13a8d87d7434f35eb1938457ff82dcfd56dd2922 | |
parent | bca7faea5410d50d2a3be4b11688f02a2fb2ee95 (diff) | |
download | linux-stable-321bc88ec098845ec93d047858a010d41be26ed9.tar.gz linux-stable-321bc88ec098845ec93d047858a010d41be26ed9.tar.bz2 linux-stable-321bc88ec098845ec93d047858a010d41be26ed9.zip |
netfilter: nf_tables: free set name in error path
commit 2f6adf481527c8ab8033c601f55bfb5b3712b2ac upstream.
set->name must be free'd here in case ops->init fails.
Fixes: 387454901bd6 ("netfilter: nf_tables: Allow set names of up to 255 chars")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/netfilter/nf_tables_api.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 5b504aa653f5..6295af0693cf 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3196,18 +3196,20 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, err = ops->init(set, &desc, nla); if (err < 0) - goto err2; + goto err3; err = nft_trans_set_add(&ctx, NFT_MSG_NEWSET, set); if (err < 0) - goto err3; + goto err4; list_add_tail_rcu(&set->list, &table->sets); table->use++; return 0; -err3: +err4: ops->destroy(set); +err3: + kfree(set->name); err2: kvfree(set); err1: |