From 2655f626323b1618ce6b8ce04e654a62ffeb912a Mon Sep 17 00:00:00 2001 From: David Greenman Date: Mon, 13 Feb 1995 13:45:04 +0000 Subject: [PATCH] In sync(), don't dereference the proc pointer if it's NULL. Should fix most or all of the problems with calling sync() without a curproc (which can happen in machdep.c during a panic sync). --- sys/kern/vfs_extattr.c | 4 ++-- sys/kern/vfs_syscalls.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index e5c52188c854..b63f7482795a 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.15 1994/10/21 01:19:15 wollman Exp $ + * $Id: vfs_syscalls.c,v 1.16 1994/11/04 14:41:34 davidg Exp $ */ #include @@ -331,7 +331,7 @@ sync(p, uap, retval) !vfs_busy(mp)) { asyncflag = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; - VFS_SYNC(mp, MNT_NOWAIT, p->p_ucred, p); + VFS_SYNC(mp, MNT_NOWAIT, p != NULL ? p->p_ucred : NOCRED, p); if (asyncflag) mp->mnt_flag |= MNT_ASYNC; vfs_unbusy(mp); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index e5c52188c854..b63f7482795a 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.15 1994/10/21 01:19:15 wollman Exp $ + * $Id: vfs_syscalls.c,v 1.16 1994/11/04 14:41:34 davidg Exp $ */ #include @@ -331,7 +331,7 @@ sync(p, uap, retval) !vfs_busy(mp)) { asyncflag = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; - VFS_SYNC(mp, MNT_NOWAIT, p->p_ucred, p); + VFS_SYNC(mp, MNT_NOWAIT, p != NULL ? p->p_ucred : NOCRED, p); if (asyncflag) mp->mnt_flag |= MNT_ASYNC; vfs_unbusy(mp);