[ovs-dev] [ERSPAN RFC 14/25] ip_gre: fix potential memory leak in erspan_rcv
Greg Rose
gvrose8192 at gmail.com
Thu Mar 22 22:07:30 UTC 2018
From: Haishuang Yan <yanhaishuang at cmss.chinamobile.com>
Upstream commit:
commit 50670b6ee9bc4ae8f9ce3112b437987adf273245
Author: Haishuang Yan <yanhaishuang at cmss.chinamobile.com>
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 <u9012063 at gmail.com>
Signed-off-by: Haishuang Yan <yanhaishuang at cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Cc: Haishuang Yan <yanhaishuang at cmss.chinamobile.com>
Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
---
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
More information about the dev
mailing list