From 6892986c7db05c281322f1f8870f5a46d4080e99 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Mon, 20 Mar 2017 21:23:48 -0700 Subject: [PATCH] ipv4: keep skb->dst around in presence of IP options Upstream commit 34b2cef20f19c87999fff3da4071e66937db9644 ("ipv4: keep skb->dst around in presence of IP options") incorrectly root caused commit d826eb14ecef ("ipv4: PKTINFO doesnt need dst reference") as bug origin. This patch should fix the issue for 3.2.xx stable kernels, since IPv4 options seem to get more traction these days, after years of oblivion ;) Fixes: f84af32cbca70 ("net: ip_queue_rcv_skb() helper")) Signed-off-by: Eric Dumazet Reported-by: Anarcheuz Fritz Signed-off-by: Ben Hutchings --- net/ipv4/ip_sockglue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index b3648bbef0da..a6e1eeb02267 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -1009,7 +1009,8 @@ e_inval: */ int ip_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { - if (!(inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO)) + if (!(inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) && + !IPCB(skb)->opt.optlen) skb_dst_drop(skb); return sock_queue_rcv_skb(sk, skb); } -- 2.39.2