Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/hfs Fix another fine example of "if you make the kern...



details:   https://anonhg.NetBSD.org/src/rev/542d1a837f90
branches:  trunk
changeset: 749358:542d1a837f90
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Nov 27 16:11:35 2009 +0000

description:
Fix another fine example of "if you make the kernel panic, it's
more secure".

diffstat:

 sys/fs/hfs/hfs_vfsops.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (43 lines):

diff -r 3051263ba941 -r 542d1a837f90 sys/fs/hfs/hfs_vfsops.c
--- a/sys/fs/hfs/hfs_vfsops.c   Fri Nov 27 15:58:39 2009 +0000
+++ b/sys/fs/hfs/hfs_vfsops.c   Fri Nov 27 16:11:35 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hfs_vfsops.c,v 1.22 2009/06/29 05:08:17 dholland Exp $ */
+/*     $NetBSD: hfs_vfsops.c,v 1.23 2009/11/27 16:11:35 pooka Exp $    */
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.22 2009/06/29 05:08:17 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.23 2009/11/27 16:11:35 pooka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -279,14 +279,16 @@
         * updating the mount is okay (for example, as far as securelevel goes)
         * which leaves us with the normal check.
         */
-       accessmode = VREAD;
-       if (update ?
-               (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
-               (mp->mnt_flag & MNT_RDONLY) == 0)
-               accessmode |= VWRITE;
-       vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
-       error = genfs_can_mount(devvp, accessmode, l->l_cred);
-       VOP_UNLOCK(devvp, 0);
+       if (error == 0) {
+               accessmode = VREAD;
+               if (update ?
+                       (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
+                       (mp->mnt_flag & MNT_RDONLY) == 0)
+                       accessmode |= VWRITE;
+               vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+               error = genfs_can_mount(devvp, accessmode, l->l_cred);
+               VOP_UNLOCK(devvp, 0);
+       }
 
        if (error != 0)
                goto error;



Home | Main Index | Thread Index | Old Index