From: Haishuang Yan <[email protected]>
Upstream commit:
commit 50670b6ee9bc4ae8f9ce3112b437987adf273245
Author: Haishuang Yan <[email protected]>
Date: Wed Dec 20 10:07:00 2017 +0800
ip_gre: fix potential memory leak in erspan_rcv
If md is NULL, tun_dst must be freed, otherwise it will cause memory
leak.
Fixes: 1a66a836da6 ("gre: add collect_md mode to ERSPAN tunnel")
Cc: William Tu <[email protected]>
Signed-off-by: Haishuang Yan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Cc: Haishuang Yan <[email protected]>
Signed-off-by: Greg Rose <[email protected]>
---
datapath/linux/compat/ip_gre.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index 7cd35a3..f315b16 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -193,8 +193,10 @@ static int erspan_rcv(struct sk_buff *skb, struct
tnl_ptk_info *tpi,
tun_id, sizeof(*md));
md = ip_tunnel_info_opts(&tun_dst.u.tun_info);
- if (!md)
+ if (!md) {
+ dst_release((struct dst_entry *)tun_dst);
return PACKET_REJECT;
+ }
memcpy(md, pkt_md, sizeof(*md));
info = &tun_dst.u.tun_info;
--
1.8.3.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev