summaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2017-10-17 19:07:44 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-19 14:17:39 +0200
commit010f245b9dd734adda6386c494a4ace953ea8dc4 (patch)
treee74de233d9da5944058f3a357b949160524f863c /drivers/net/tun.c
parentmqprio: fix potential null pointer dereference on opt (diff)
downloadlinux-010f245b9dd734adda6386c494a4ace953ea8dc4.tar.xz
linux-010f245b9dd734adda6386c494a4ace953ea8dc4.zip
tun: relax check on eth_get_headlen() return value
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 57e4c31fa84a..c64ec19af9b7 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);