netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ip_forward: Drop frames with attached skb->sk
@ 2015-04-20  7:19 Sebastian Poehn
  2015-04-20 18:08 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Poehn @ 2015-04-20  7:19 UTC (permalink / raw)
  To: netdev

Initial discussion was:
[FYI] xfrm: Don't lookup sk_policy for timewait sockets

Forwarded frames should not have a socket attached. Especially
tw sockets will lead to panics later-on in the stack.

This was observed with TPROXY assigning a tw socket and broken
policy routing (misconfigured). As a result frame enters
forwarding path instead of input. We cannot solve this in
TPROXY as it cannot know that policy routing is broken.

v2:
Remove useless comment

Signed-off-by: Sebastian Poehn <sebastian.poehn@gmail.com>
---
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 939992c..3674484 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -82,6 +82,9 @@ int ip_forward(struct sk_buff *skb)
 	if (skb->pkt_type != PACKET_HOST)
 		goto drop;
 
+	if (unlikely(skb->sk))
+		goto drop;
+
 	if (skb_warn_if_lro(skb))
 		goto drop;
 
--

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

* Re: [PATCH v2] ip_forward: Drop frames with attached skb->sk
  2015-04-20  7:19 [PATCH v2] ip_forward: Drop frames with attached skb->sk Sebastian Poehn
@ 2015-04-20 18:08 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-04-20 18:08 UTC (permalink / raw)
  To: sebastian.poehn; +Cc: netdev

From: Sebastian Poehn <sebastian.poehn@gmail.com>
Date: Mon, 20 Apr 2015 09:19:20 +0200

> Initial discussion was:
> [FYI] xfrm: Don't lookup sk_policy for timewait sockets
> 
> Forwarded frames should not have a socket attached. Especially
> tw sockets will lead to panics later-on in the stack.
> 
> This was observed with TPROXY assigning a tw socket and broken
> policy routing (misconfigured). As a result frame enters
> forwarding path instead of input. We cannot solve this in
> TPROXY as it cannot know that policy routing is broken.
> 
> v2:
> Remove useless comment
> 
> Signed-off-by: Sebastian Poehn <sebastian.poehn@gmail.com>

Applied and queued up for -stable, thanks Sebastian.

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

end of thread, other threads:[~2015-04-20 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-20  7:19 [PATCH v2] ip_forward: Drop frames with attached skb->sk Sebastian Poehn
2015-04-20 18:08 ` 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).