Module Name: src Committed By: hannken Date: Thu Nov 19 10:47:47 UTC 2020
Modified Files: src/sys/kern: vfs_mount.c Log Message: We have to ignore interrupts when suspending here the same way we have to do with revoke. Reported-by: syzbot+0cfb253b382a98364...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/kern/vfs_mount.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_mount.c diff -u src/sys/kern/vfs_mount.c:1.84 src/sys/kern/vfs_mount.c:1.85 --- src/sys/kern/vfs_mount.c:1.84 Tue Oct 13 13:15:39 2020 +++ src/sys/kern/vfs_mount.c Thu Nov 19 10:47:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.84 2020/10/13 13:15:39 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.85 2020/11/19 10:47:47 hannken Exp $ */ /*- * Copyright (c) 1997-2020 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.84 2020/10/13 13:15:39 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.85 2020/11/19 10:47:47 hannken Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -730,7 +730,7 @@ mount_domount(struct lwp *l, vnode_t **v struct mount *mp; struct pathbuf *pb; struct nameidata nd; - int error; + int error, error2; error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT, KAUTH_REQ_SYSTEM_MOUNT_NEW, vp, KAUTH_ARG(flags), data); @@ -832,11 +832,16 @@ mount_domount(struct lwp *l, vnode_t **v return error; err_mounted: - if (vfs_suspend(mp, 0)) - panic("Suspending fresh file system failed"); + do { + error2 = vfs_suspend(mp, 0); + } while (error2 == EINTR || error2 == ERESTART); + KASSERT(error2 == 0 || error2 == EOPNOTSUPP); + if (VFS_UNMOUNT(mp, MNT_FORCE) != 0) panic("Unmounting fresh file system failed"); - vfs_resume(mp); + + if (error2 == 0) + vfs_resume(mp); err_unmounted: vp->v_mountedhere = NULL;