diff options
author | Steve French <sfrench@us.ibm.com> | 2006-09-06 18:02:22 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-09-06 18:02:22 -0400 |
commit | b835bebe95608c81270636a78b70333afb011925 (patch) | |
tree | 147d1b5dbb879651b3c4d74e7f1a394a496b2fdb /fs | |
parent | 10387e5eb45c6e48d67102b88229f5bc6037461c (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.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 105761e3ba0e..9aeb58a7d369 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, | |||
82 | if(*ptmp_inode == NULL) | 82 | if(*ptmp_inode == NULL) |
83 | return rc; | 83 | return rc; |
84 | rc = 1; | 84 | rc = 1; |
85 | d_instantiate(tmp_dentry, *ptmp_inode); | ||
86 | } | 85 | } |
87 | } else { | 86 | } else { |
88 | tmp_dentry = d_alloc(file->f_dentry, qstring); | 87 | tmp_dentry = d_alloc(file->f_dentry, qstring); |
@@ -99,9 +98,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file, | |||
99 | tmp_dentry->d_op = &cifs_dentry_ops; | 98 | tmp_dentry->d_op = &cifs_dentry_ops; |
100 | if(*ptmp_inode == NULL) | 99 | if(*ptmp_inode == NULL) |
101 | return rc; | 100 | return rc; |
102 | rc = 1; | 101 | rc = 2; |
103 | d_instantiate(tmp_dentry, *ptmp_inode); | ||
104 | d_rehash(tmp_dentry); | ||
105 | } | 102 | } |
106 | 103 | ||
107 | tmp_dentry->d_time = jiffies; | 104 | tmp_dentry->d_time = jiffies; |
@@ -870,6 +867,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file, | |||
870 | pfindEntry, &obj_type, rc); | 867 | pfindEntry, &obj_type, rc); |
871 | else | 868 | else |
872 | fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc); | 869 | fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc); |
870 | |||
871 | if(rc) /* new inode - needs to be tied to dentry */ { | ||
872 | d_instantiate(tmp_dentry, tmp_inode); | ||
873 | if(rc == 2) | ||
874 | d_rehash(tmp_dentry); | ||
875 | } | ||
873 | 876 | ||
874 | 877 | ||
875 | rc = filldir(direntry,qstring.name,qstring.len,file->f_pos, | 878 | rc = filldir(direntry,qstring.name,qstring.len,file->f_pos, |