Commit b835bebe authored by Steve French's avatar Steve French

[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: default avatarSteve French <sfrench@us.ibm.com>
Acked-by: default avatarEric Paris <eparis@redhat.com>
Acked-by: default avatarDave Kleikamp <shaggy@austin.ibm.com>
parent 10387e5e
...@@ -82,7 +82,6 @@ static int construct_dentry(struct qstr *qstring, struct file *file, ...@@ -82,7 +82,6 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
if(*ptmp_inode == NULL) if(*ptmp_inode == NULL)
return rc; return rc;
rc = 1; rc = 1;
d_instantiate(tmp_dentry, *ptmp_inode);
} }
} else { } else {
tmp_dentry = d_alloc(file->f_dentry, qstring); tmp_dentry = d_alloc(file->f_dentry, qstring);
...@@ -99,9 +98,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file, ...@@ -99,9 +98,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
tmp_dentry->d_op = &cifs_dentry_ops; tmp_dentry->d_op = &cifs_dentry_ops;
if(*ptmp_inode == NULL) if(*ptmp_inode == NULL)
return rc; return rc;
rc = 1; rc = 2;
d_instantiate(tmp_dentry, *ptmp_inode);
d_rehash(tmp_dentry);
} }
tmp_dentry->d_time = jiffies; tmp_dentry->d_time = jiffies;
...@@ -871,6 +868,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file, ...@@ -871,6 +868,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
else else
fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc); 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, rc = filldir(direntry,qstring.name,qstring.len,file->f_pos,
tmp_inode->i_ino,obj_type); tmp_inode->i_ino,obj_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment