Source-Changes-HG archive

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

[src/trunk]: src/sys/dev cons(4): Don't barge ahead if cdevvp has failed -- r...



details:   https://anonhg.NetBSD.org/src/rev/24de6fb64c2e
branches:  trunk
changeset: 369577:24de6fb64c2e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 22 00:20:56 2022 +0000

description:
cons(4): Don't barge ahead if cdevvp has failed -- return error now.

diffstat:

 sys/dev/cons.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r d458a34284f8 -r 24de6fb64c2e sys/dev/cons.c
--- a/sys/dev/cons.c    Mon Aug 22 00:20:45 2022 +0000
+++ b/sys/dev/cons.c    Mon Aug 22 00:20:56 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $      */
+/*     $NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.78 2022/08/22 00:20:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -131,8 +131,10 @@
        }
        if (cn_devvp[unit] != NULLVP)
                return 0;
-       if ((error = cdevvp(cndev, &cn_devvp[unit])) != 0)
+       if ((error = cdevvp(cndev, &cn_devvp[unit])) != 0) {
                printf("cnopen: unable to get vnode reference\n");
+               return error;
+       }
        vn_lock(cn_devvp[unit], LK_EXCLUSIVE | LK_RETRY);
        error = VOP_OPEN(cn_devvp[unit], flag, kauth_cred_get());
        VOP_UNLOCK(cn_devvp[unit]);



Home | Main Index | Thread Index | Old Index