mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-17 08:00:48 +01:00
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).
This commit is contained in:
parent
1e3a24e880
commit
2655f62632
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6343
@ -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 <sys/param.h>
|
||||
@ -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);
|
||||
|
@ -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 <sys/param.h>
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user