Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern We have to ignore interrupts when suspending here t...



details:   https://anonhg.NetBSD.org/src/rev/deff1c0f3778
branches:  trunk
changeset: 957133:deff1c0f3778
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Nov 19 10:47:47 2020 +0000

description:
We have to ignore interrupts when suspending here the same way
we have to do with revoke.

Reported-by: syzbot+0cfb253b382a9836450a%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/vfs_mount.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r ef57977207f6 -r deff1c0f3778 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c      Thu Nov 19 10:45:36 2020 +0000
+++ b/sys/kern/vfs_mount.c      Thu Nov 19 10:47:47 2020 +0000
@@ -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 @@
        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 @@
        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;



Home | Main Index | Thread Index | Old Index