lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  6 Mar 2019 11:32:27 +0100
From:   Nicolas Dichtel <nicolas.dichtel@...nd.com>
To:     davem@...emloft.net
Cc:     netdev@...r.kernel.org,
        Nicolas Dichtel <nicolas.dichtel@...nd.com>,
        wenxu <wenxu@...oud.cn>
Subject: [PATCH net] gre: fix kernel panic when using lw tunnel

There was several problems:
 - skb_dst(skb) can be NULL when the packet comes from a gretap tunnel;
 - skb_dst(skb)->ops may point to md_dst_ops, which doesn't set ->mtu
   handler, thus calling dst_mtu() leads to a panic.

I also wonder if ->cow_metrics may be called if skb_dst(skb)->ops points
to ovs_dst_ops.

Don't try to do anything in one of those cases.

Fixes: 962924fa2b7a ("ip_gre: Refactor collect metatdata mode tunnel xmit to ip_md_tunnel_xmit")
CC: wenxu <wenxu@...oud.cn>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
---
 net/ipv4/ip_tunnel.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 2756fb725bf0..e2e0e4601c0f 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -508,6 +508,12 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,
 	int pkt_size;
 	int mtu;
 
+	if (!skb_dst(skb) ||
+	    !skb_dst(skb)->ops->mtu ||
+	    (dst_metrics_read_only(skb_dst(skb)) &&
+	     !skb_dst(skb)->ops->cow_metrics))
+		return 0;
+
 	tunnel_hlen = md ? tunnel_hlen : tunnel->hlen;
 	pkt_size = skb->len - tunnel_hlen - dev->hard_header_len;
 
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ