Skip to content

Commit

Permalink
net: erspan: remove md NULL check
Browse files Browse the repository at this point in the history
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: afb4c97 ("ip6_gre: fix potential memory leak in ip6erspan_rcv")
Fixes: 50670b6 ("ip_gre: fix potential memory leak in erspan_rcv")
Cc: Haishuang Yan <[email protected]>
Signed-off-by: William Tu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
williamtu authored and davem330 committed Dec 26, 2017
1 parent fb7df5e commit 214bb1c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
5 changes: 0 additions & 5 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
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;

Expand Down
4 changes: 0 additions & 4 deletions net/ipv6/ip6_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,6 @@ static int ip6erspan_rcv(struct sk_buff *skb, int gre_hdr_len,

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;
Expand Down

0 comments on commit 214bb1c

Please sign in to comment.