diff options
| author | KATO Takenori <kato@FreeBSD.org> | 1997-08-14 03:57:46 +0000 |
|---|---|---|
| committer | KATO Takenori <kato@FreeBSD.org> | 1997-08-14 03:57:46 +0000 |
| commit | 5842d4e5b2a53b4913cfce91014d97dba980a27f (patch) | |
| tree | d414c61294295195a961fa5648d51dcf7a9057e7 | |
| parent | 3dc942bbe9472e9bfcfe963865383d83c0e266b1 (diff) | |
Notes
| -rw-r--r-- | sys/fs/unionfs/union_subr.c | 12 | ||||
| -rw-r--r-- | sys/miscfs/union/union_subr.c | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 493a172eac54..7f85e65611de 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 - * $Id: union_subr.c,v 1.18 1997/04/16 16:24:24 kato Exp $ + * $Id: union_subr.c,v 1.19 1997/08/02 14:32:28 bde Exp $ */ #include <sys/param.h> @@ -650,6 +650,16 @@ union_copyup(un, docopy, cred, p) int error; struct vnode *lvp, *uvp; + /* + * If the user does not have read permission, the vnode should not + * be copied to upper layer. + */ + vn_lock(un->un_lowervp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_ACCESS(un->un_lowervp, VREAD, cred, p); + VOP_UNLOCK(un->un_lowervp, 0, p); + if (error) + return (error); + error = union_vn_create(&uvp, un, p); if (error) return (error); diff --git a/sys/miscfs/union/union_subr.c b/sys/miscfs/union/union_subr.c index 493a172eac54..7f85e65611de 100644 --- a/sys/miscfs/union/union_subr.c +++ b/sys/miscfs/union/union_subr.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 - * $Id: union_subr.c,v 1.18 1997/04/16 16:24:24 kato Exp $ + * $Id: union_subr.c,v 1.19 1997/08/02 14:32:28 bde Exp $ */ #include <sys/param.h> @@ -650,6 +650,16 @@ union_copyup(un, docopy, cred, p) int error; struct vnode *lvp, *uvp; + /* + * If the user does not have read permission, the vnode should not + * be copied to upper layer. + */ + vn_lock(un->un_lowervp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_ACCESS(un->un_lowervp, VREAD, cred, p); + VOP_UNLOCK(un->un_lowervp, 0, p); + if (error) + return (error); + error = union_vn_create(&uvp, un, p); if (error) return (error); |
