Skip to content

Commit

Permalink
net: erspan: fix wrong return value
Browse files Browse the repository at this point in the history
If pskb_may_pull return failed, return PACKET_REJECT
instead of -ENOMEM.

Fixes: 94d7d8f ("ip6_gre: add erspan v2 support")
Fixes: f551c91 ("net: erspan: introduce erspan v2 for ip_gre")
Signed-off-by: William Tu <[email protected]>
Cc: Haishuang Yan <[email protected]>
Acked-by: Haishuang Yan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
williamtu authored and davem330 committed Dec 18, 2017
1 parent 814a178 commit ae3e133
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
if (tunnel) {
len = gre_hdr_len + erspan_hdr_len(ver);
if (unlikely(!pskb_may_pull(skb, len)))
return -ENOMEM;
return PACKET_REJECT;

if (__iptunnel_pull_header(skb,
len,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/ip6_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ static int ip6erspan_rcv(struct sk_buff *skb, int gre_hdr_len,
int len = erspan_hdr_len(ver);

if (unlikely(!pskb_may_pull(skb, len)))
return -ENOMEM;
return PACKET_REJECT;

if (__iptunnel_pull_header(skb, len,
htons(ETH_P_TEB),
Expand Down

0 comments on commit ae3e133

Please sign in to comment.