diff options
-rw-r--r-- | sys/kern/vfs_lookup.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 484889c7cd2..efda601ea0d 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_lookup.c,v 1.71 2018/07/13 09:25:23 beck Exp $ */ +/* $OpenBSD: vfs_lookup.c,v 1.72 2018/07/30 00:16:59 beck Exp $ */ /* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */ /* @@ -558,11 +558,13 @@ dirloop: } /* * If creating and at end of pathname, then can consider - * allowing file to be created. + * allowing file to be created. Check for a read only + * filesystem and disallow this unless we are unveil'ing */ - if (rdonly || (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY)) { - error = EROFS; - goto bad; + if (ndp->ni_pledge != PLEDGE_UNVEIL && (rdonly || + (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY))) { + error = EROFS; + goto bad; } /* * We return with ni_vp NULL to indicate that the entry |