[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1453856382.11327.49.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Tue, 26 Jan 2016 16:59:42 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Joe Stringer <joe@....org>, David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>, fw@...len.de,
hannes@...essinduktion.org, pravin shelar <pshelar@....org>
Subject: [PATCH net] ipv4: early demux should be aware of fragments
From: Eric Dumazet <edumazet@...gle.com>
We should not assume a valid protocol header is present,
as this is not the case for IPv4 fragments.
Lets avoid extra cache line misses and potential bugs
if we actually find a socket and incorrectly uses its dst.
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
net/ipv4/ip_input.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index b1209b63381f..d77eb0c3b684 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -316,7 +316,10 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
const struct iphdr *iph = ip_hdr(skb);
struct rtable *rt;
- if (sysctl_ip_early_demux && !skb_dst(skb) && !skb->sk) {
+ if (sysctl_ip_early_demux &&
+ !skb_dst(skb) &&
+ !skb->sk &&
+ !ip_is_fragment(iph)) {
const struct net_protocol *ipprot;
int protocol = iph->protocol;
Powered by blists - more mailing lists