Source-Changes-HG archive

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

[src/trunk]: src/sys/kern The panic for fopen(NULL, ... is back, fix it



details:   https://anonhg.NetBSD.org/src/rev/13461cc84e82
branches:  trunk
changeset: 996626:13461cc84e82
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Feb 05 13:50:10 2019 +0000

description:
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

diffstat:

 sys/kern/vfs_syscalls.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 2bbc0aa8d8c4 -r 13461cc84e82 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Tue Feb 05 13:02:35 2019 +0000
+++ b/sys/kern/vfs_syscalls.c   Tue Feb 05 13:50:10 2019 +0000
@@ -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 @@
 
        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;



Home | Main Index | Thread Index | Old Index