netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tun: relax check on eth_get_headlen() return value
@ 2017-10-17 17:07 Eric Dumazet
  2017-10-19 12:18 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2017-10-17 17:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Petar Penkov

From: Eric Dumazet <edumazet@google.com>

syzkaller hit the WARN() in tun_get_user(), providing skb
with payload in fragments only, and nothing in skb->head

GRO layer is fine with this, so relax the check.

Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/tun.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 57e4c31fa84adc4d9af6ab69a87feac23a8b034e..c64ec19af9b73744270f5cdb922d0f0c1c8f4443 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1737,7 +1737,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 		/* Exercise flow dissector code path. */
 		u32 headlen = eth_get_headlen(skb->data, skb_headlen(skb));
 
-		if (headlen > skb_headlen(skb) || headlen < ETH_HLEN) {
+		if (unlikely(headlen > skb_headlen(skb))) {
 			this_cpu_inc(tun->pcpu_stats->rx_dropped);
 			napi_free_frags(&tfile->napi);
 			mutex_unlock(&tfile->napi_mutex);

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

* Re: [PATCH net-next] tun: relax check on eth_get_headlen() return value
  2017-10-17 17:07 [PATCH net-next] tun: relax check on eth_get_headlen() return value Eric Dumazet
@ 2017-10-19 12:18 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-19 12:18 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, peterpenkov96

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 17 Oct 2017 10:07:44 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> syzkaller hit the WARN() in tun_get_user(), providing skb
> with payload in fragments only, and nothing in skb->head
> 
> GRO layer is fine with this, so relax the check.
> 
> Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 17:07 [PATCH net-next] tun: relax check on eth_get_headlen() return value Eric Dumazet
2017-10-19 12:18 ` 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).