Skip to content

Commit c7256f5

Browse files
Eric Dumazetdavem330
Eric Dumazet
authored andcommitted
tun: initialize napi_mutex unconditionally
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: 90e33d4 ("tun: enable napi_gro_frags() for TUN/TAP driver") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: [email protected] Signed-off-by: David S. Miller <[email protected]>
1 parent 06e55ad commit c7256f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/tun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile,
320320
netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll,
321321
NAPI_POLL_WEIGHT);
322322
napi_enable(&tfile->napi);
323-
mutex_init(&tfile->napi_mutex);
324323
}
325324
}
326325

@@ -3199,6 +3198,7 @@ static int tun_chr_open(struct inode *inode, struct file * file)
31993198
return -ENOMEM;
32003199
}
32013200

3201+
mutex_init(&tfile->napi_mutex);
32023202
RCU_INIT_POINTER(tfile->tun, NULL);
32033203
tfile->flags = 0;
32043204
tfile->ifindex = 0;

0 commit comments

Comments
 (0)