aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2006-09-06 22:02:22 +0000
committerSteve French <sfrench@us.ibm.com>2006-09-06 22:02:22 +0000
commitb835bebe95608c81270636a78b70333afb011925 (patch)
tree147d1b5dbb879651b3c4d74e7f1a394a496b2fdb /fs
parent10387e5eb45c6e48d67102b88229f5bc6037461c (diff)
[CIFS] Fix CIFS readdir access denied when SE Linux enabled
CIFS had one path in which dentry was instantiated before the corresponding inode metadata was filled in. Fixes Redhat bugzilla bug #163493 Signed-off-by: Steve French <sfrench@us.ibm.com> Acked-by: Eric Paris <eparis@redhat.com> Acked-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/readdir.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 105761e3ba0..9aeb58a7d36 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -82,7 +82,6 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
if(*ptmp_inode == NULL)
return rc;
rc = 1;
- d_instantiate(tmp_dentry, *ptmp_inode);
}
} else {
tmp_dentry = d_alloc(file->f_dentry, qstring);
@@ -99,9 +98,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
tmp_dentry->d_op = &cifs_dentry_ops;
if(*ptmp_inode == NULL)
return rc;
- rc = 1;
- d_instantiate(tmp_dentry, *ptmp_inode);
- d_rehash(tmp_dentry);
+ rc = 2;
}
tmp_dentry->d_time = jiffies;
@@ -870,6 +867,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
pfindEntry, &obj_type, rc);
else
fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc);
+
+ if(rc) /* new inode - needs to be tied to dentry */ {
+ d_instantiate(tmp_dentry, tmp_inode);
+ if(rc == 2)
+ d_rehash(tmp_dentry);
+ }
rc = filldir(direntry,qstring.name,qstring.len,file->f_pos,