From f5b5f684fdf2e98d8493f864abee3644531345ca Mon Sep 17 00:00:00 2001 From: ericm Date: Sun, 10 Jul 2005 05:17:51 +0000 Subject: [PATCH] mds_open() better to check permission even it's open request for device files, otherwise client vfs will check that and failed siliently which cause request leak. (client's interaction with vfs seems not perfect -- can't handle all error cases) --- lustre/mds/mds_open.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 46d9591..7dd38da 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1287,7 +1287,17 @@ got_child: if ((rec->ur_flags & MDS_OPEN_DIRECTORY) && !S_ISDIR(dchild->d_inode->i_mode)) GOTO(cleanup, rc = -ENOTDIR); - + + /* check permission even it's special files */ + if (S_ISCHR(dchild->d_inode->i_mode) || + S_ISBLK(dchild->d_inode->i_mode) || + S_ISFIFO(dchild->d_inode->i_mode) || + S_ISSOCK(dchild->d_inode->i_mode)) { + rc = ll_permission(dchild->d_inode, acc_mode, NULL); + if (rc != 0) + GOTO(cleanup, rc); + } + if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OPEN_CREATE)) { obd_fail_loc = OBD_FAIL_LDLM_REPLY | OBD_FAIL_ONCE; GOTO(cleanup, rc = -EAGAIN); -- 1.8.3.1