If pskb_may_pull return failed, return PACKET_REJECT instead of -ENOMEM.
Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
Cc: William Tu <[email protected]>
Signed-off-by: Haishuang Yan <[email protected]>
---
net/ipv4/ip_gre.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 61ee014..d747d06 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -267,7 +267,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
len = gre_hdr_len + sizeof(*ershdr);
if (unlikely(!pskb_may_pull(skb, len)))
- return -ENOMEM;
+ return PACKET_REJECT;
iph = ip_hdr(skb);
ershdr = (struct erspanhdr *)(skb->data + gre_hdr_len);
--
1.8.3.1
On Thu, Dec 14, 2017 at 6:46 PM, Haishuang Yan
<[email protected]> wrote:
> If pskb_may_pull return failed, return PACKET_REJECT instead of -ENOMEM.
>
> Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
> Cc: William Tu <[email protected]>
> Signed-off-by: Haishuang Yan <[email protected]>
> ---
Thanks for the patch.
I think the other way is simply to just 'goto drop', freeing the skb
in erspan_rcv(), instead of 'return PACKET_REJECT'. I'm ok either way.
Acked-by: William Tu <[email protected]>
From: Haishuang Yan <[email protected]>
Date: Fri, 15 Dec 2017 10:46:16 +0800
> If pskb_may_pull return failed, return PACKET_REJECT instead of -ENOMEM.
>
> Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
> Cc: William Tu <[email protected]>
> Signed-off-by: Haishuang Yan <[email protected]>
Applied.