Source-Changes-HG archive

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

[src/trunk]: src/sys/kern don't skip the rdir check for the lazy case; breaks...



details:   https://anonhg.NetBSD.org/src/rev/c97896873dce
branches:  trunk
changeset: 745510:c97896873dce
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 03 19:55:16 2020 +0000

description:
don't skip the rdir check for the lazy case; breaks chroot df(1) hiding.

diffstat:

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

diffs (41 lines):

diff -r a3ed43d7c479 -r c97896873dce sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Tue Mar 03 17:09:22 2020 +0000
+++ b/sys/kern/vfs_syscalls.c   Tue Mar 03 19:55:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.542 2020/02/23 22:14:04 ad Exp $    */
+/*     $NetBSD: vfs_syscalls.c,v 1.543 2020/03/03 19:55:16 christos Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.542 2020/02/23 22:14:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.543 2020/03/03 19:55:16 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1108,18 +1108,19 @@
         * refresh the fsstat cache. MNT_WAIT or MNT_LAZY
         * overrides MNT_NOWAIT.
         */
+       KASSERT(l == curlwp);
+       rvp = cwdrdir();
        if (flags == MNT_NOWAIT || flags == MNT_LAZY ||
            (flags != MNT_WAIT && flags != 0)) {
                memcpy(sp, &mp->mnt_stat, sizeof(*sp));
-               rvp = NULL;
        } else {
                /* Get the filesystem stats now */
                memset(sp, 0, sizeof(*sp));
                if ((error = VFS_STATVFS(mp, sp)) != 0) {
+                       if (rvp)
+                               vrele(rvp);
                        return error;
                }
-               KASSERT(l == curlwp);
-               rvp = cwdrdir();
                if (rvp == NULL)
                        (void)memcpy(&mp->mnt_stat, sp, sizeof(mp->mnt_stat));
        }



Home | Main Index | Thread Index | Old Index