The 'md' is allocated from 'tun_dst = ip_tun_rx_dst' and
since we've checked 'tun_dst', 'md' will never be NULL.
The patch removes it at both ipv4 and ipv6 erspan.
Fixes:
afb4c97d90e6 ("ip6_gre: fix potential memory leak in ip6erspan_rcv")
Fixes:
50670b6ee9bc ("ip_gre: fix potential memory leak in erspan_rcv")
Cc: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
return PACKET_REJECT;
md = ip_tunnel_info_opts(&tun_dst->u.tun_info);
- if (!md) {
- dst_release((struct dst_entry *)tun_dst);
- return PACKET_REJECT;
- }
-
memcpy(md, pkt_md, sizeof(*md));
md->version = ver;
info = &tun_dst->u.tun_info;
md = ip_tunnel_info_opts(info);
- if (!md) {
- dst_release((struct dst_entry *)tun_dst);
- return PACKET_REJECT;
- }
memcpy(md, pkt_md, sizeof(*md));
md->version = ver;