1
0
Fork 0

netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done()

If there is no NFTA_OBJ_TABLE and NFTA_OBJ_TYPE, the c.data will be NULL in
nf_tables_getobj(). So before free filter->table in nf_tables_dump_obj_done(),
we need to check if filter is NULL first.

Fixes: e46abbcc05 ("netfilter: nf_tables: Allow table names of up to 255 chars")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
zero-colors
Hangbin Liu 2017-12-25 11:34:54 +08:00 committed by Pablo Neira Ayuso
parent 4c82fd0abb
commit 8bea728dce
1 changed files with 4 additions and 2 deletions

View File

@ -4665,8 +4665,10 @@ static int nf_tables_dump_obj_done(struct netlink_callback *cb)
{
struct nft_obj_filter *filter = cb->data;
kfree(filter->table);
kfree(filter);
if (filter) {
kfree(filter->table);
kfree(filter);
}
return 0;
}