Source-Changes-HG archive

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

[src/trunk]: src/sys/fs Lock devvp for kauth KAUTH_REQ_SYSTEM_MOUNT_DEVICE.



details:   https://anonhg.NetBSD.org/src/rev/28da0457b41b
branches:  trunk
changeset: 365912:28da0457b41b
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue May 03 07:34:38 2022 +0000

description:
Lock devvp for kauth KAUTH_REQ_SYSTEM_MOUNT_DEVICE.

diffstat:

 sys/fs/sysvbfs/sysvbfs_vfsops.c |  6 ++++--
 sys/fs/v7fs/v7fs_vfsops.c       |  7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (61 lines):

diff -r 9db9c37377af -r 28da0457b41b sys/fs/sysvbfs/sysvbfs_vfsops.c
--- a/sys/fs/sysvbfs/sysvbfs_vfsops.c   Tue May 03 07:33:07 2022 +0000
+++ b/sys/fs/sysvbfs/sysvbfs_vfsops.c   Tue May 03 07:34:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysvbfs_vfsops.c,v 1.47 2020/01/17 20:08:08 ad Exp $   */
+/*     $NetBSD: sysvbfs_vfsops.c,v 1.48 2022/05/03 07:34:38 hannken Exp $      */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.47 2020/01/17 20:08:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.48 2022/05/03 07:34:38 hannken Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -139,9 +139,11 @@
                    (mp->mnt_flag & MNT_RDONLY) == 0)
                        accessmode |= VWRITE;
 
+               vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
                error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
                    KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
                    KAUTH_ARG(accessmode));
+               VOP_UNLOCK(devvp);
        }
 
        if (error) {
diff -r 9db9c37377af -r 28da0457b41b sys/fs/v7fs/v7fs_vfsops.c
--- a/sys/fs/v7fs/v7fs_vfsops.c Tue May 03 07:33:07 2022 +0000
+++ b/sys/fs/v7fs/v7fs_vfsops.c Tue May 03 07:34:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: v7fs_vfsops.c,v 1.18 2022/02/05 14:11:52 zafer Exp $   */
+/*     $NetBSD: v7fs_vfsops.c,v 1.19 2022/05/03 07:34:38 hannken Exp $ */
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.18 2022/02/05 14:11:52 zafer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.19 2022/05/03 07:34:38 hannken Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -157,9 +157,12 @@
                    (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
                    (mp->mnt_flag & MNT_RDONLY) == 0)
                        accessmode |= VWRITE;
+
+               vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
                error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
                    KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
                    KAUTH_ARG(accessmode));
+               VOP_UNLOCK(devvp);
        }
 
        if (error) {



Home | Main Index | Thread Index | Old Index