From 1375b63a1710e0d7903f5644dc3eb909838351b8 Mon Sep 17 00:00:00 2001 From: millert Date: Wed, 6 Jul 2016 19:26:35 +0000 Subject: [PATCH] Return EINVAL for mknod/mknodat when dev is -1 (aka VNOVAL). OK beck@ tedu@ --- sys/kern/vfs_syscalls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 4378e3d3c1a..1b01622dbac 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.260 2016/07/03 04:36:08 semarie Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.261 2016/07/06 19:26:35 millert Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -1228,6 +1228,8 @@ domknodat(struct proc *p, int fd, const char *path, mode_t mode, dev_t dev) if (p->p_fd->fd_rdir) return (EINVAL); } + if (dev == VNOVAL) + return (EINVAL); NDINITAT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, fd, path, p); nd.ni_pledge = PLEDGE_DPATH; if ((error = namei(&nd)) != 0) -- 2.20.1