Netfilter fixes for net
Subsystems (3)
Pablo Neira Ayuso
maintainercover Netfilter fixes for net
Hi David,
The following patchset contains Netfilter fixes for your net tree, they are:
1) Fix chain filtering when dumping rules via nf_tables_dump_rules().
2) Fix accidental change in NF_CT_STATE_UNTRACKED_BIT through uapi, introduced when removing the untracked conntrack object, from Florian Westphal.
3) Fix potential nul-dereference when releasing dump filter in nf_tables_dump_obj_done(), patch from Hangbin Liu.
You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
Thanks!
----------------------------------------------------------------
The following changes since commit b4681c2829e24943aadd1a7bb3a30d41d0a20050:
ipv4: Fix use-after-free when flushing FIB tables (2017-12-20 15:12:39 -0500)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git HEAD
for you to fetch changes up to 8bea728dce8972e534e6b99fd550f7b5cc3864e8:
netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done() (2017-12-26 17:16:47 +0100)
----------------------------------------------------------------
Florian Westphal (1):
netfilter: uapi: correct UNTRACKED conntrack state bit number
Hangbin Liu (1):
netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done()
Pablo Neira Ayuso (1):
netfilter: nf_tables: fix chain filter in nf_tables_dump_rules()
include/uapi/linux/netfilter/nf_conntrack_common.h | 2 +- net/netfilter/nf_tables_api.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-)
Pablo Neira Ayuso
maintainerPATCH 1/3 netfilter: nf_tables: fix chain filter in nf_tables_dump_rules()
ctx->chain may be null now that we have very large object names, so we cannot check for ctx->chain[0] here.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -2072,7 +2072,7 @@ static int nf_tables_dump_rules(struct sk_buff *skb,continue ;list_for_each_entry_rcu (chain, &table->chains, list) { -if (ctx && ctx->chain[0 ] && +if (ctx && ctx->chain &&strcmp (ctx->chain, chain->name) !=0 )continue ;
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 2/3 netfilter: uapi: correct UNTRACKED conntrack state bit number
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
nft_ct exposes this bit to userspace. This used to be
#define NF_CT_STATE_UNTRACKED_BIT (1 << (IP_CT_NUMBER + 1)) (IP_CT_NUMBER is 5, so this was 0x40)
.. but this got changed to 8 (0x100) when the untracked object got removed. Replace this with a literal 6 to prevent further incompatible changes in case IP_CT_NUMBER ever increases.
--- include/uapi/linux/netfilter/nf_conntrack_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netfilter/nf_conntrack_common.h +1 -1
@@ -36,7 +36,7 @@ enum ip_conntrack_info {#define NF_CT_STATE_INVALID_BIT (1 << 0)#define NF_CT_STATE_BIT (ctinfo) (1 << ((ctinfo) % IP_CT_IS_REPLY + 1)) -#define NF_CT_STATE_UNTRACKED_BIT (1 << (IP_CT_UNTRACKED + 1)) +#define NF_CT_STATE_UNTRACKED_BIT (1 << 6)/* Bitset representing status of connection. */ enum ip_conntrack_status {
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 3/3 netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done()
In reply to Pablo Neira AyusoFrom: Hangbin Liu <[email protected]>
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.
--- net/netfilter/nf_tables_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/netfilter/nf_tables_api.c +4 -2
@@ -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 ; }
Signature · 1 line
2.11.0
David Miller
maintainerFrom: Pablo Neira Ayuso <[email protected]>
Date: Fri, 5 Jan 2018 16:08:22 +0100
Quoted 9 lines
The following patchset contains Netfilter fixes for your net tree, they are:
1) Fix chain filtering when dumping rules via
nf_tables_dump_rules().2) Fix accidental change in
NF_CT_STATE_UNTRACKED_BITthrough uapi, introduced when removing the untracked conntrack object, from Florian Westphal.
Quoted 6 lines
3) Fix potential nul-dereference when releasing dump filter in
nf_tables_dump_obj_done(), patch from Hangbin Liu.You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
Pulled, thanks Pablo.