Module Name:    src
Committed By:   kamil
Date:           Tue Feb  5 13:50:10 UTC 2019

Modified Files:
        src/sys/kern: vfs_syscalls.c

Log Message:
The panic for fopen(NULL, ... is back, fix it

Restore the original behavior before merging the compat refactoring branch.

Now:
 - no compat_10 -> perform pathbuf_copyin() and report EFAULT
 - compat_10 and error -> report error
 - compat_10 and success -> return file descriptor for "."

PR kern/53948


To generate a diff of this commit:
cvs rdiff -u -r1.523 -r1.524 src/sys/kern/vfs_syscalls.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_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.523 src/sys/kern/vfs_syscalls.c:1.524
--- src/sys/kern/vfs_syscalls.c:1.523	Tue Feb  5 09:34:38 2019
+++ src/sys/kern/vfs_syscalls.c	Tue Feb  5 13:50:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.523 2019/02/05 09:34:38 pgoyette Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.524 2019/02/05 13:50:10 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.523 2019/02/05 09:34:38 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.524 2019/02/05 13:50:10 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1636,9 +1636,12 @@ do_sys_openat(lwp_t *l, int fdat, const 
 
 	if (path == NULL) {
 		MODULE_CALL_HOOK(vfs_openat_10_hook, (&pb), enosys(), error);
-		if (error != 0 && error != ENOSYS)
+		if (error == ENOSYS)
+			goto no_compat;
+		if (error)
 			return error;
 	} else {
+no_compat:
 		error = pathbuf_copyin(path, &pb);
 		if (error)
 			return error;

Reply via email to