[ovs-dev,ERSPAN,RFC,11/25] ip_gre: fix wrong return value of erspan_rcv

Message ID 1521756461-3870-12-git-send-email-gvrose8192@gmail.com
State RFC
Headers show
  • Introduce ERSPAN for OVS
Related show

Commit Message

Gregory Rose March 22, 2018, 10:07 p.m.
From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

Upstream commit:
    commit c05fad5713b81b049ec6ac4eb2d304030b1efdce
    Author: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
    Date:   Fri Dec 15 10:46:16 2017 +0800

    ip_gre: fix wrong return value of erspan_rcv

    If pskb_may_pull return failed, return PACKET_REJECT instead of -ENOMEM.

    Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
    Cc: William Tu <u9012063@gmail.com>
    Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
    Acked-by: William Tu <u9012063@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Cc:  Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
 datapath/linux/compat/ip_gre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index eeea4bb..183b451 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -169,7 +169,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,