net: erspan: fix wrong return value
authorWilliam Tu <u9012063@gmail.com>
Fri, 15 Dec 2017 22:27:43 +0000 (14:27 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Dec 2017 20:11:25 +0000 (15:11 -0500)
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>
net/ipv4/ip_gre.c
net/ipv6/ip6_gre.c

index 9a80d84fc182c289484fb011cb4cf6859a6a893f..b3a32a98024051ae5063ae606187b89f593e19b3 100644 (file)
@@ -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,
index 5c9c65f1d5c260bf8548b8145180325c74414319..b3e4e0384f361bd5b089dedd7f7e87c2d12e0bd2 100644 (file)
@@ -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),