Module Name: src Committed By: hannken Date: Thu Mar 7 11:09:48 UTC 2019
Modified Files: src/sys/kern: vfs_vnops.c Log Message: Change vn_openchk() to fail VNON and VBAD with error ENXIO. Reported-by: syzbot+d66b1be08516a4d2d...@syzkaller.appspotmail.com Reported-by: syzbot+c5eaef5a8af535c3b...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.199 -r1.200 src/sys/kern/vfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_vnops.c diff -u src/sys/kern/vfs_vnops.c:1.199 src/sys/kern/vfs_vnops.c:1.200 --- src/sys/kern/vfs_vnops.c:1.199 Mon Feb 4 04:18:59 2019 +++ src/sys/kern/vfs_vnops.c Thu Mar 7 11:09:48 2019 @@ -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 @@ vn_openchk(struct vnode *vp, kauth_cred_ 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;