From e4b56cf059f99a955f4d97ca2e693a5563d26163 Mon Sep 17 00:00:00 2001 From: kettenis Date: Fri, 22 Jul 2016 09:54:09 +0000 Subject: [PATCH] Prevent NULL-pointer call for filesystems that don't provide vfs_sysctl in their vfsops. Issue reported by Tim Newsham. ok claudio@, natano@ --- sys/kern/vfs_subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7411a924724..661b5de0597 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.248 2016/06/19 11:54:33 natano Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.249 2016/07/22 09:54:09 kettenis Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1290,7 +1290,7 @@ vfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, if (vfsp->vfc_typenum == name[0]) break; - if (vfsp == NULL) + if (vfsp == NULL || vfsp->vfc_vfsops->vfs_sysctl == NULL) return (EOPNOTSUPP); return ((*vfsp->vfc_vfsops->vfs_sysctl)(&name[1], namelen - 1, -- 2.20.1