mirror of
https://github.com/torvalds/linux.git
synced 2026-05-10 09:09:50 -04:00
netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done()
[ Upstream commit8bea728dce] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
cdbde4c04c
commit
cbc3dbfe4f
@@ -4596,8 +4596,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user