If the user doesn't have read permission, union_copyup should not copy
a file to upper layer. Reviewed by: Naofumi Honda <honda@Kururu.math.sci.hokudai.ac.jp>
This commit is contained in:
parent
3dc942bbe9
commit
5842d4e5b2
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user