diff options
author | William Tu <u9012063@gmail.com> | 2017-12-15 17:27:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-18 15:11:25 -0500 |
commit | ae3e13373b879670d873e5657a903bd208f0dc40 (patch) | |
tree | 90eaf8a48762d72aef82758d5961159a042e14af | |
parent | 814a17841325643e2d08984d076f976a0b423872 (diff) |
net: erspan: fix wrong return value
If pskb_may_pull return failed, return PACKET_REJECT
instead of -ENOMEM.
Fixes: 94d7d8f29287 ("ip6_gre: add erspan v2 support")
Fixes: f551c91de262 ("net: erspan: introduce erspan v2 for ip_gre")
Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Acked-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/ip_gre.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_gre.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 9a80d84fc182..b3a32a980240 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -287,7 +287,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, | |||
287 | if (tunnel) { | 287 | if (tunnel) { |
288 | len = gre_hdr_len + erspan_hdr_len(ver); | 288 | len = gre_hdr_len + erspan_hdr_len(ver); |
289 | if (unlikely(!pskb_may_pull(skb, len))) | 289 | if (unlikely(!pskb_may_pull(skb, len))) |
290 | return -ENOMEM; | 290 | return PACKET_REJECT; |
291 | 291 | ||
292 | if (__iptunnel_pull_header(skb, | 292 | if (__iptunnel_pull_header(skb, |
293 | len, | 293 | len, |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 5c9c65f1d5c2..b3e4e0384f36 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -524,7 +524,7 @@ static int ip6erspan_rcv(struct sk_buff *skb, int gre_hdr_len, | |||
524 | int len = erspan_hdr_len(ver); | 524 | int len = erspan_hdr_len(ver); |
525 | 525 | ||
526 | if (unlikely(!pskb_may_pull(skb, len))) | 526 | if (unlikely(!pskb_may_pull(skb, len))) |
527 | return -ENOMEM; | 527 | return PACKET_REJECT; |
528 | 528 | ||
529 | if (__iptunnel_pull_header(skb, len, | 529 | if (__iptunnel_pull_header(skb, len, |
530 | htons(ETH_P_TEB), | 530 | htons(ETH_P_TEB), |