Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/sysvbfs In sysvbfs_lookup(), deny last component writ...
details: https://anonhg.NetBSD.org/src/rev/94461a20c0f7
branches: trunk
changeset: 761543:94461a20c0f7
user: njoly <njoly%NetBSD.org@localhost>
date: Mon Jan 31 18:48:50 2011 +0000
description:
In sysvbfs_lookup(), deny last component write operation on a
read-only mount.
Fix PR/44302: sysvbfs allows unlink on fs mounted MNT_RDONLY.
Reviewed by pooka.
diffstat:
sys/fs/sysvbfs/sysvbfs_vnops.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 415dc2e98587 -r 94461a20c0f7 sys/fs/sysvbfs/sysvbfs_vnops.c
--- a/sys/fs/sysvbfs/sysvbfs_vnops.c Mon Jan 31 18:28:05 2011 +0000
+++ b/sys/fs/sysvbfs/sysvbfs_vnops.c Mon Jan 31 18:48:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysvbfs_vnops.c,v 1.35 2010/11/30 10:43:04 dholland Exp $ */
+/* $NetBSD: sysvbfs_vnops.c,v 1.36 2011/01/31 18:48:50 njoly Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.35 2010/11/30 10:43:04 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.36 2011/01/31 18:48:50 njoly Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -85,10 +85,16 @@
*a->a_vpp = NULL;
KASSERT((cnp->cn_flags & ISDOTDOT) == 0);
+
if ((error = VOP_ACCESS(a->a_dvp, VEXEC, cnp->cn_cred)) != 0) {
return error; /* directory permission. */
}
+ /* Deny last component write operation on a read-only mount */
+ if ((cnp->cn_flags & ISLASTCN) && (v->v_mount->mnt_flag & MNT_RDONLY) &&
+ (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
+ return EROFS;
+
if (namelen == 1 && name[0] == '.') { /* "." */
vref(v);
*a->a_vpp = v;
Home |
Main Index |
Thread Index |
Old Index