]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: nftables: Fix a memleak from userdata error path in new objects
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 5 May 2021 21:06:43 +0000 (23:06 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 5 May 2021 21:52:52 +0000 (23:52 +0200)
Release object name if userdata allocation fails.

Fixes: 56d1146d3f1a ("netfilter: nf_tables: add userdata support for nft_object")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index 0b7fe0a902ff56c162741e6715ad62d928381ea7..926da6ed8d512babeb99453c6bdf5c6972fd5ed9 100644 (file)
@@ -6615,9 +6615,9 @@ err_obj_ht:
        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);