diff options
author | anton <anton@cvs.openbsd.org> | 2018-07-03 12:58:19 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2018-07-03 12:58:19 +0000 |
commit | ef85ce4a4698c1a1240eff196304566d884fa00a (patch) | |
tree | 5eb720d827c31369ec1872ac9614175f0691e6cf /sys | |
parent | ea6b58da3e5dc490de3dcbef384598809301baa6 (diff) |
Avoid NULL pointer deref in vn_writechk() when calling ftruncate() on a file
descriptor belonging to a cloned device.
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_vnops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 03fe499734c..2dbc93adba4 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.93 2018/06/07 13:37:27 visa Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.94 2018/07/03 12:58:18 anton Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -205,7 +205,7 @@ vn_writechk(struct vnode *vp) * unless the file is a socket or a block or character * device resident on the file system. */ - if (vp->v_mount->mnt_flag & MNT_RDONLY) { + if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_RDONLY)) { switch (vp->v_type) { case VREG: case VDIR: |