diff options
author | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
commit | cb5629b10d64a8006622ce3a52bc887d91057d69 (patch) | |
tree | 7c06d8f30783115e3384721046258ce615b129c5 /fs/seq_file.c | |
parent | 8920d5ad6ba74ae8ab020e90cc4d976980e68701 (diff) | |
parent | f01d1d546abb2f4028b5299092f529eefb01253a (diff) |
Merge branch 'master' into next
Conflicts:
fs/namei.c
Manually merged per:
diff --cc fs/namei.c
index 734f2b5,bbc15c2..0000000
--- a/fs/namei.c
+++ b/fs/namei.c
@@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char
nd->flags |= LOOKUP_CONTINUE;
err = exec_permission_lite(inode);
if (err == -EAGAIN)
- err = vfs_permission(nd, MAY_EXEC);
+ err = inode_permission(nd->path.dentry->d_inode,
+ MAY_EXEC);
+ if (!err)
+ err = ima_path_check(&nd->path, MAY_EXEC);
if (err)
break;
@@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc
flag &= ~O_TRUNC;
}
- error = vfs_permission(nd, acc_mode);
+ error = inode_permission(inode, acc_mode);
if (error)
return error;
+
- error = ima_path_check(&nd->path,
++ error = ima_path_check(path,
+ acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
+ if (error)
+ return error;
/*
* An append-only file must be opened in append mode for writing.
*/
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r-- | fs/seq_file.c | 128 |
1 files changed, 68 insertions, 60 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c index 16c211558c22..5267098532bf 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -54,6 +54,64 @@ int seq_open(struct file *file, const struct seq_operations *op) | |||
54 | } | 54 | } |
55 | EXPORT_SYMBOL(seq_open); | 55 | EXPORT_SYMBOL(seq_open); |
56 | 56 | ||
57 | static int traverse(struct seq_file *m, loff_t offset) | ||
58 | { | ||
59 | loff_t pos = 0, index; | ||
60 | int error = 0; | ||
61 | void *p; | ||
62 | |||
63 | m->version = 0; | ||
64 | index = 0; | ||
65 | m->count = m->from = 0; | ||
66 | if (!offset) { | ||
67 | m->index = index; | ||
68 | return 0; | ||
69 | } | ||
70 | if (!m->buf) { | ||
71 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | ||
72 | if (!m->buf) | ||
73 | return -ENOMEM; | ||
74 | } | ||
75 | p = m->op->start(m, &index); | ||
76 | while (p) { | ||
77 | error = PTR_ERR(p); | ||
78 | if (IS_ERR(p)) | ||
79 | break; | ||
80 | error = m->op->show(m, p); | ||
81 | if (error < 0) | ||
82 | break; | ||
83 | if (unlikely(error)) { | ||
84 | error = 0; | ||
85 | m->count = 0; | ||
86 | } | ||
87 | if (m->count == m->size) | ||
88 | goto Eoverflow; | ||
89 | if (pos + m->count > offset) { | ||
90 | m->from = offset - pos; | ||
91 | m->count -= m->from; | ||
92 | m->index = index; | ||
93 | break; | ||
94 | } | ||
95 | pos += m->count; | ||
96 | m->count = 0; | ||
97 | if (pos == offset) { | ||
98 | index++; | ||
99 | m->index = index; | ||
100 | break; | ||
101 | } | ||
102 | p = m->op->next(m, p, &index); | ||
103 | } | ||
104 | m->op->stop(m, p); | ||
105 | m->index = index; | ||
106 | return error; | ||
107 | |||
108 | Eoverflow: | ||
109 | m->op->stop(m, p); | ||
110 | kfree(m->buf); | ||
111 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | ||
112 | return !m->buf ? -ENOMEM : -EAGAIN; | ||
113 | } | ||
114 | |||
57 | /** | 115 | /** |
58 | * seq_read - ->read() method for sequential files. | 116 | * seq_read - ->read() method for sequential files. |
59 | * @file: the file to read from | 117 | * @file: the file to read from |
@@ -186,63 +244,6 @@ Efault: | |||
186 | } | 244 | } |
187 | EXPORT_SYMBOL(seq_read); | 245 | EXPORT_SYMBOL(seq_read); |
188 | 246 | ||
189 | static int traverse(struct seq_file *m, loff_t offset) | ||
190 | { | ||
191 | loff_t pos = 0, index; | ||
192 | int error = 0; | ||
193 | void *p; | ||
194 | |||
195 | m->version = 0; | ||
196 | index = 0; | ||
197 | m->count = m->from = 0; | ||
198 | if (!offset) { | ||
199 | m->index = index; | ||
200 | return 0; | ||
201 | } | ||
202 | if (!m->buf) { | ||
203 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | ||
204 | if (!m->buf) | ||
205 | return -ENOMEM; | ||
206 | } | ||
207 | p = m->op->start(m, &index); | ||
208 | while (p) { | ||
209 | error = PTR_ERR(p); | ||
210 | if (IS_ERR(p)) | ||
211 | break; | ||
212 | error = m->op->show(m, p); | ||
213 | if (error < 0) | ||
214 | break; | ||
215 | if (unlikely(error)) { | ||
216 | error = 0; | ||
217 | m->count = 0; | ||
218 | } | ||
219 | if (m->count == m->size) | ||
220 | goto Eoverflow; | ||
221 | if (pos + m->count > offset) { | ||
222 | m->from = offset - pos; | ||
223 | m->count -= m->from; | ||
224 | m->index = index; | ||
225 | break; | ||
226 | } | ||
227 | pos += m->count; | ||
228 | m->count = 0; | ||
229 | if (pos == offset) { | ||
230 | index++; | ||
231 | m->index = index; | ||
232 | break; | ||
233 | } | ||
234 | p = m->op->next(m, p, &index); | ||
235 | } | ||
236 | m->op->stop(m, p); | ||
237 | return error; | ||
238 | |||
239 | Eoverflow: | ||
240 | m->op->stop(m, p); | ||
241 | kfree(m->buf); | ||
242 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | ||
243 | return !m->buf ? -ENOMEM : -EAGAIN; | ||
244 | } | ||
245 | |||
246 | /** | 247 | /** |
247 | * seq_lseek - ->llseek() method for sequential files. | 248 | * seq_lseek - ->llseek() method for sequential files. |
248 | * @file: the file in question | 249 | * @file: the file in question |
@@ -389,8 +390,14 @@ char *mangle_path(char *s, char *p, char *esc) | |||
389 | } | 390 | } |
390 | EXPORT_SYMBOL(mangle_path); | 391 | EXPORT_SYMBOL(mangle_path); |
391 | 392 | ||
392 | /* | 393 | /** |
393 | * return the absolute path of 'dentry' residing in mount 'mnt'. | 394 | * seq_path - seq_file interface to print a pathname |
395 | * @m: the seq_file handle | ||
396 | * @path: the struct path to print | ||
397 | * @esc: set of characters to escape in the output | ||
398 | * | ||
399 | * return the absolute path of 'path', as represented by the | ||
400 | * dentry / mnt pair in the path parameter. | ||
394 | */ | 401 | */ |
395 | int seq_path(struct seq_file *m, struct path *path, char *esc) | 402 | int seq_path(struct seq_file *m, struct path *path, char *esc) |
396 | { | 403 | { |
@@ -462,7 +469,8 @@ int seq_dentry(struct seq_file *m, struct dentry *dentry, char *esc) | |||
462 | return -1; | 469 | return -1; |
463 | } | 470 | } |
464 | 471 | ||
465 | int seq_bitmap(struct seq_file *m, unsigned long *bits, unsigned int nr_bits) | 472 | int seq_bitmap(struct seq_file *m, const unsigned long *bits, |
473 | unsigned int nr_bits) | ||
466 | { | 474 | { |
467 | if (m->count < m->size) { | 475 | if (m->count < m->size) { |
468 | int len = bitmap_scnprintf(m->buf + m->count, | 476 | int len = bitmap_scnprintf(m->buf + m->count, |