netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done()
authorHangbin Liu <liuhangbin@gmail.com>
Mon, 25 Dec 2017 03:34:54 +0000 (11:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:24:30 +0000 (10:24 +0100)
commitcbc3dbfe4f37d541d57c0acafa8bb463ed178ef5
tree89a937dcdeafa26fad8d1ca09c8575071d701af2
parentcdbde4c04c5c63ccf7d91122d39ce0dbea71dbfa
netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done()

[ Upstream commit 8bea728dce8972e534e6b99fd550f7b5cc3864e8 ]

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: e46abbcc05aa ("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>
net/netfilter/nf_tables_api.c