* [PATCH 0/3] Netfilter fixes for net
@ 2018-01-05 15:08 Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 1/3] netfilter: nf_tables: fix chain filter in nf_tables_dump_rules() Pablo Neira Ayuso
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2018-01-05 15:08 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
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(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] netfilter: nf_tables: fix chain filter in nf_tables_dump_rules()
2018-01-05 15:08 [PATCH 0/3] Netfilter fixes for net Pablo Neira Ayuso
@ 2018-01-05 15:08 ` Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 2/3] netfilter: uapi: correct UNTRACKED conntrack state bit number Pablo Neira Ayuso
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2018-01-05 15:08 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
ctx->chain may be null now that we have very large object names,
so we cannot check for ctx->chain[0] here.
Fixes: b7263e071aba7 ("netfilter: nf_tables: Allow table names of up to 255 chars")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: Phil Sutter <phil@nwl.cc>
---
net/netfilter/nf_tables_api.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 10798b357481..8d4526651661 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -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;
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] netfilter: uapi: correct UNTRACKED conntrack state bit number
2018-01-05 15:08 [PATCH 0/3] Netfilter fixes for net Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 1/3] netfilter: nf_tables: fix chain filter in nf_tables_dump_rules() Pablo Neira Ayuso
@ 2018-01-05 15:08 ` Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 3/3] netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done() Pablo Neira Ayuso
2018-01-05 15:33 ` [PATCH 0/3] Netfilter fixes for net David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2018-01-05 15:08 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Florian Westphal <fw@strlen.de>
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.
Fixes: cc41c84b7e7f2 ("netfilter: kill the fake untracked conntrack objects")
Reported-by: Li Shuang <shuali@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/uapi/linux/netfilter/nf_conntrack_common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
index 3fea7709a441..57ccfb32e87f 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -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 {
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done()
2018-01-05 15:08 [PATCH 0/3] Netfilter fixes for net Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 1/3] netfilter: nf_tables: fix chain filter in nf_tables_dump_rules() Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 2/3] netfilter: uapi: correct UNTRACKED conntrack state bit number Pablo Neira Ayuso
@ 2018-01-05 15:08 ` Pablo Neira Ayuso
2018-01-05 15:33 ` [PATCH 0/3] Netfilter fixes for net David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2018-01-05 15:08 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Hangbin Liu <liuhangbin@gmail.com>
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>
---
net/netfilter/nf_tables_api.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 8d4526651661..07bd4138c84e 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -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;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Netfilter fixes for net
2018-01-05 15:08 [PATCH 0/3] Netfilter fixes for net Pablo Neira Ayuso
` (2 preceding siblings ...)
2018-01-05 15:08 ` [PATCH 3/3] netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done() Pablo Neira Ayuso
@ 2018-01-05 15:33 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-01-05 15:33 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Fri, 5 Jan 2018 16:08:22 +0100
> 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
Pulled, thanks Pablo.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-05 15:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-05 15:08 [PATCH 0/3] Netfilter fixes for net Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 1/3] netfilter: nf_tables: fix chain filter in nf_tables_dump_rules() Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 2/3] netfilter: uapi: correct UNTRACKED conntrack state bit number Pablo Neira Ayuso
2018-01-05 15:08 ` [PATCH 3/3] netfilter: nf_tables: fix potential NULL-ptr deref in nf_tables_dump_obj_done() Pablo Neira Ayuso
2018-01-05 15:33 ` [PATCH 0/3] Netfilter fixes for net David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).