netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ip_gre: fix wrong return value of erspan_rcv
@ 2017-12-15  2:46 Haishuang Yan
  2017-12-15 16:26 ` William Tu
  2017-12-15 19:10 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Haishuang Yan @ 2017-12-15  2:46 UTC (permalink / raw)
  To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
  Cc: netdev, linux-kernel, Haishuang Yan, William Tu

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>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ip_gre: fix wrong return value of erspan_rcv
  2017-12-15  2:46 [PATCH] ip_gre: fix wrong return value of erspan_rcv Haishuang Yan
@ 2017-12-15 16:26 ` William Tu
  2017-12-15 19:10 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: William Tu @ 2017-12-15 16:26 UTC (permalink / raw)
  To: Haishuang Yan
  Cc: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI,
	Linux Kernel Network Developers, linux-kernel

On Thu, Dec 14, 2017 at 6:46 PM, Haishuang Yan
<yanhaishuang@cmss.chinamobile.com> 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 <u9012063@gmail.com>
> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> ---

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 <u9012063@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ip_gre: fix wrong return value of erspan_rcv
  2017-12-15  2:46 [PATCH] ip_gre: fix wrong return value of erspan_rcv Haishuang Yan
  2017-12-15 16:26 ` William Tu
@ 2017-12-15 19:10 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-12-15 19:10 UTC (permalink / raw)
  To: yanhaishuang; +Cc: kuznet, yoshfuji, netdev, linux-kernel, u9012063

From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
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 <u9012063@gmail.com>
> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-15 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-15  2:46 [PATCH] ip_gre: fix wrong return value of erspan_rcv Haishuang Yan
2017-12-15 16:26 ` William Tu
2017-12-15 19:10 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).