All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	<netdev@vger.kernel.org>
Subject: [PATCH 09/11] esp: Fix GRO when the headers not fully in the linear part of the skb.
Date: Thu, 11 Jan 2018 12:37:44 +0100	[thread overview]
Message-ID: <20180111113746.28186-10-steffen.klassert@secunet.com> (raw)
In-Reply-To: <20180111113746.28186-1-steffen.klassert@secunet.com>

The GRO layer does not necessarily pull the complete headers
into the linear part of the skb, a part may remain on the
first page fragment. This can lead to a crash if we try to
pull the headers, so make sure we have them on the linear
part before pulling.

Fixes: 7785bba299a8 ("esp: Add a software GRO codepath")
Reported-by: syzbot+82bbd65569c49c6c0c4d@syzkaller.appspotmail.com
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/ipv4/esp4_offload.c | 3 ++-
 net/ipv6/esp6_offload.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
index f8b918c766b0..b1338e576d00 100644
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -38,7 +38,8 @@ static struct sk_buff **esp4_gro_receive(struct sk_buff **head,
 	__be32 spi;
 	int err;
 
-	skb_pull(skb, offset);
+	if (!pskb_pull(skb, offset))
+		return NULL;
 
 	if ((err = xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq)) != 0)
 		goto out;
diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c
index 333a478aa161..dd9627490c7c 100644
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -60,7 +60,8 @@ static struct sk_buff **esp6_gro_receive(struct sk_buff **head,
 	int nhoff;
 	int err;
 
-	skb_pull(skb, offset);
+	if (!pskb_pull(skb, offset))
+		return NULL;
 
 	if ((err = xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq)) != 0)
 		goto out;
-- 
2.14.1

  parent reply	other threads:[~2018-01-11 11:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 11:37 pull request (net): ipsec 2018-01-11 Steffen Klassert
2018-01-11 11:37 ` [PATCH 01/11] xfrm: Forbid state updates from changing encap type Steffen Klassert
2018-01-11 11:37 ` [PATCH 02/11] xfrm: skip policies marked as dead while rehashing Steffen Klassert
2018-01-11 11:37 ` [PATCH 03/11] af_key: fix buffer overread in verify_address_len() Steffen Klassert
2018-01-11 11:37 ` [PATCH 04/11] af_key: fix buffer overread in parse_exthdrs() Steffen Klassert
2018-01-11 11:37 ` [PATCH 05/11] xfrm: fix rcu usage in xfrm_get_type_offload Steffen Klassert
2018-01-11 11:37 ` [PATCH 06/11] xfrm: Use __skb_queue_tail in xfrm_trans_queue Steffen Klassert
2018-01-11 11:37 ` [PATCH 07/11] xfrm: Return error on unknown encap_type in init_state Steffen Klassert
2018-01-11 11:37 ` [PATCH 08/11] xfrm: don't call xfrm_policy_cache_flush while holding spinlock Steffen Klassert
2018-01-11 11:37 ` Steffen Klassert [this message]
2018-01-11 11:37 ` [PATCH 10/11] af_key: Fix memory leak in key_notify_policy Steffen Klassert
2018-01-11 11:37 ` [PATCH 11/11] xfrm: Fix a race in the xdst pcpu cache Steffen Klassert
2018-01-12 15:33 ` pull request (net): ipsec 2018-01-11 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180111113746.28186-10-steffen.klassert@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.