Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Change vn_openchk() to fail VNON and VBAD with erro...



details:   https://anonhg.NetBSD.org/src/rev/0915046b7a63
branches:  trunk
changeset: 449437:0915046b7a63
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Mar 07 11:09:48 2019 +0000

description:
Change vn_openchk() to fail VNON and VBAD with error ENXIO.

Reported-by: syzbot+d66b1be08516a4d2d2b2%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+c5eaef5a8af535c3b217%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/vfs_vnops.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 0bf3b97a6c85 -r 0915046b7a63 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c      Thu Mar 07 11:09:10 2019 +0000
+++ b/sys/kern/vfs_vnops.c      Thu Mar 07 11:09:48 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnops.c,v 1.199 2019/02/04 04:18:59 mrg Exp $      */
+/*     $NetBSD: vfs_vnops.c,v 1.200 2019/03/07 11:09:48 hannken Exp $  */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.199 2019/02/04 04:18:59 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.200 2019/03/07 11:09:48 hannken Exp $");
 
 #include "veriexec.h"
 
@@ -297,6 +297,9 @@
        int permbits = 0;
        int error;
 
+       if (vp->v_type == VNON || vp->v_type == VBAD)
+               return ENXIO;
+
        if ((fflags & O_DIRECTORY) != 0 && vp->v_type != VDIR)
                return ENOTDIR;
 



Home | Main Index | Thread Index | Old Index