summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-09-28 14:51:48 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-18 09:18:08 +0200
commitd013c6b952f011c980bb4ebdc83e6511d3fa4358 (patch)
treecaa9ef814528d1c7c2a8341c5df8d748acd9e1a8 /drivers/net
parent7d96410f397bbcaee3e1b81d50e37d35cfa6795c (diff)
downloadlinux-stable-d013c6b952f011c980bb4ebdc83e6511d3fa4358.tar.gz
linux-stable-d013c6b952f011c980bb4ebdc83e6511d3fa4358.tar.bz2
linux-stable-d013c6b952f011c980bb4ebdc83e6511d3fa4358.zip
tun: initialize napi_mutex unconditionally
[ Upstream commit c7256f579f8302ce2c038181c30060d0b40017b2 ] This is the first part to fix following syzbot report : console output: https://syzkaller.appspot.com/x/log.txt?x=145378e6400000 kernel config: https://syzkaller.appspot.com/x/.config?x=443816db871edd66 dashboard link: https://syzkaller.appspot.com/bug?extid=e662df0ac1d753b57e80 Following patch is fixing the race condition, but it seems safer to initialize this mutex at tfile creation anyway. Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot+e662df0ac1d753b57e80@syzkaller.appspotmail.com Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-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 dc2fcddb625d..410c03564a69 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -319,7 +319,6 @@ static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile,
netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll,
NAPI_POLL_WEIGHT);
napi_enable(&tfile->napi);
- mutex_init(&tfile->napi_mutex);
}
}
@@ -3241,6 +3240,7 @@ static int tun_chr_open(struct inode *inode, struct file * file)
return -ENOMEM;
}
+ mutex_init(&tfile->napi_mutex);
RCU_INIT_POINTER(tfile->tun, NULL);
tfile->flags = 0;
tfile->ifindex = 0;