Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/specfs specfs: Factor common kauth check out of s...



details:   https://anonhg.NetBSD.org/src/rev/b07d199beb02
branches:  trunk
changeset: 364499:b07d199beb02
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 28 12:34:51 2022 +0000

description:
specfs: Factor common kauth check out of switch in spec_open.

No functional change.

diffstat:

 sys/miscfs/specfs/spec_vnops.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (46 lines):

diff -r d319f43e621f -r b07d199beb02 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c    Mon Mar 28 12:34:42 2022 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c    Mon Mar 28 12:34:51 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spec_vnops.c,v 1.188 2022/03/28 12:34:42 riastradh Exp $       */
+/*     $NetBSD: spec_vnops.c,v 1.189 2022/03/28 12:34:51 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.188 2022/03/28 12:34:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.189 2022/03/28 12:34:51 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -546,13 +546,12 @@
                req = KAUTH_REQ_DEVICE_RAWIO_SPEC_READ;
                break;
        }
+       error = kauth_authorize_device_spec(ap->a_cred, req, vp);
+       if (error != 0)
+               return (error);
 
        switch (vp->v_type) {
        case VCHR:
-               error = kauth_authorize_device_spec(ap->a_cred, req, vp);
-               if (error != 0)
-                       return (error);
-
                /*
                 * Character devices can accept opens from multiple
                 * vnodes.
@@ -595,10 +594,6 @@
                break;
 
        case VBLK:
-               error = kauth_authorize_device_spec(ap->a_cred, req, vp);
-               if (error != 0)
-                       return (error);
-
                /*
                 * For block devices, permit only one open.  The buffer
                 * cache cannot remain self-consistent with multiple



Home | Main Index | Thread Index | Old Index