netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix handling of verdicts after NF_QUEUE
@ 2017-12-11 23:30 Debabrata Banerjee
  2017-12-12  0:23 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 7+ messages in thread
From: Debabrata Banerjee @ 2017-12-11 23:30 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: David S . Miller, netfilter-devel, coreteam, netdev, stable,
	dbanerje

A verdict of NF_STOLEN after NF_QUEUE will cause an incorrect return value
and a potential kernel panic via double free of skb's

This was broken by commit 7034b566a4e7 ("netfilter: fix nf_queue handling")
and subsequently fixed in v4.10 by commit c63cbc460419 ("netfilter:
use switch() to handle verdict cases from nf_hook_slow()"). However that
commit cannot be cleanly cherry-picked to v4.9

Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>

---

This fix is only needed for v4.9 stable since v4.10+ does not have the
issue
---
 net/netfilter/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 004af030ef1a..d869ea50623e 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -364,6 +364,11 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state)
 		ret = nf_queue(skb, state, &entry, verdict);
 		if (ret == 1 && entry)
 			goto next_hook;
+	} else {
+		/* Implicit handling for NF_STOLEN, as well as any other
+		 * non conventional verdicts.
+		 */
+		ret = 0;
 	}
 	return ret;
 }
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] Fix handling of verdicts after NF_QUEUE
@ 2017-12-13 20:33 Debabrata Banerjee
  2017-12-14 12:30 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 7+ messages in thread
From: Debabrata Banerjee @ 2017-12-13 20:33 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Greg Kroah-Hartman, David S . Miller, netfilter-devel, coreteam,
	netdev, stable, dbanerje

A verdict of NF_STOLEN after NF_QUEUE will cause an incorrect return value
and a potential kernel panic via double free of skb's

This was broken by commit 7034b566a4e7 ("netfilter: fix nf_queue handling")
and subsequently fixed in v4.10 by commit c63cbc460419 ("netfilter:
use switch() to handle verdict cases from nf_hook_slow()"). However that
commit cannot be cleanly cherry-picked to v4.9

Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>

---

This fix is only needed for v4.9 stable since v4.10+ does not have the
issue
---
 net/netfilter/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 004af030ef1a..d869ea50623e 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -364,6 +364,11 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state)
 		ret = nf_queue(skb, state, &entry, verdict);
 		if (ret == 1 && entry)
 			goto next_hook;
+	} else {
+		/* Implicit handling for NF_STOLEN, as well as any other
+		 * non conventional verdicts.
+		 */
+		ret = 0;
 	}
 	return ret;
 }
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-14 17:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11 23:30 [PATCH] Fix handling of verdicts after NF_QUEUE Debabrata Banerjee
2017-12-12  0:23 ` Pablo Neira Ayuso
2017-12-12  0:36   ` Banerjee, Debabrata
2017-12-12 22:42     ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2017-12-13 20:33 Debabrata Banerjee
2017-12-14 12:30 ` Pablo Neira Ayuso
2017-12-14 17:39   ` Greg Kroah-Hartman

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).