diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-21 18:22:44 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:57:36 -0400 |
commit | da53be12bbb4fabbe2e9f6f908de0cf478b5161d (patch) | |
tree | a0436fb462a7b16c82e58336e17c55b814f7be6b /fs/isofs | |
parent | 642b704cd7a29be0b8900971eb525086c1c995b7 (diff) |
Don't pass inode to ->d_hash() and ->d_compare()
Instances either don't look at it at all (the majority of cases) or
only want it to find the superblock (which can be had as dentry->d_sb).
A few cases that want more are actually safe with dentry->d_inode -
the only precaution needed is the check that it hadn't been replaced with
NULL by rmdir() or by overwriting rename(), which case should be simply
treated as cache miss.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/isofs')
-rw-r--r-- | fs/isofs/inode.c | 48 | ||||
-rw-r--r-- | fs/isofs/namei.c | 3 |
2 files changed, 17 insertions, 34 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index d9b8aebdeb22..c348d6d88624 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -28,31 +28,23 @@ | |||
28 | 28 | ||
29 | #define BEQUIET | 29 | #define BEQUIET |
30 | 30 | ||
31 | static int isofs_hashi(const struct dentry *parent, const struct inode *inode, | 31 | static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); |
32 | struct qstr *qstr); | 32 | static int isofs_hash(const struct dentry *parent, struct qstr *qstr); |
33 | static int isofs_hash(const struct dentry *parent, const struct inode *inode, | ||
34 | struct qstr *qstr); | ||
35 | static int isofs_dentry_cmpi(const struct dentry *parent, | 33 | static int isofs_dentry_cmpi(const struct dentry *parent, |
36 | const struct inode *pinode, | 34 | const struct dentry *dentry, |
37 | const struct dentry *dentry, const struct inode *inode, | ||
38 | unsigned int len, const char *str, const struct qstr *name); | 35 | unsigned int len, const char *str, const struct qstr *name); |
39 | static int isofs_dentry_cmp(const struct dentry *parent, | 36 | static int isofs_dentry_cmp(const struct dentry *parent, |
40 | const struct inode *pinode, | 37 | const struct dentry *dentry, |
41 | const struct dentry *dentry, const struct inode *inode, | ||
42 | unsigned int len, const char *str, const struct qstr *name); | 38 | unsigned int len, const char *str, const struct qstr *name); |
43 | 39 | ||
44 | #ifdef CONFIG_JOLIET | 40 | #ifdef CONFIG_JOLIET |
45 | static int isofs_hashi_ms(const struct dentry *parent, const struct inode *inode, | 41 | static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); |
46 | struct qstr *qstr); | 42 | static int isofs_hash_ms(const struct dentry *parent, struct qstr *qstr); |
47 | static int isofs_hash_ms(const struct dentry *parent, const struct inode *inode, | ||
48 | struct qstr *qstr); | ||
49 | static int isofs_dentry_cmpi_ms(const struct dentry *parent, | 43 | static int isofs_dentry_cmpi_ms(const struct dentry *parent, |
50 | const struct inode *pinode, | 44 | const struct dentry *dentry, |
51 | const struct dentry *dentry, const struct inode *inode, | ||
52 | unsigned int len, const char *str, const struct qstr *name); | 45 | unsigned int len, const char *str, const struct qstr *name); |
53 | static int isofs_dentry_cmp_ms(const struct dentry *parent, | 46 | static int isofs_dentry_cmp_ms(const struct dentry *parent, |
54 | const struct inode *pinode, | 47 | const struct dentry *dentry, |
55 | const struct dentry *dentry, const struct inode *inode, | ||
56 | unsigned int len, const char *str, const struct qstr *name); | 48 | unsigned int len, const char *str, const struct qstr *name); |
57 | #endif | 49 | #endif |
58 | 50 | ||
@@ -265,30 +257,26 @@ static int isofs_dentry_cmp_common( | |||
265 | } | 257 | } |
266 | 258 | ||
267 | static int | 259 | static int |
268 | isofs_hash(const struct dentry *dentry, const struct inode *inode, | 260 | isofs_hash(const struct dentry *dentry, struct qstr *qstr) |
269 | struct qstr *qstr) | ||
270 | { | 261 | { |
271 | return isofs_hash_common(dentry, qstr, 0); | 262 | return isofs_hash_common(dentry, qstr, 0); |
272 | } | 263 | } |
273 | 264 | ||
274 | static int | 265 | static int |
275 | isofs_hashi(const struct dentry *dentry, const struct inode *inode, | 266 | isofs_hashi(const struct dentry *dentry, struct qstr *qstr) |
276 | struct qstr *qstr) | ||
277 | { | 267 | { |
278 | return isofs_hashi_common(dentry, qstr, 0); | 268 | return isofs_hashi_common(dentry, qstr, 0); |
279 | } | 269 | } |
280 | 270 | ||
281 | static int | 271 | static int |
282 | isofs_dentry_cmp(const struct dentry *parent, const struct inode *pinode, | 272 | isofs_dentry_cmp(const struct dentry *parent, const struct dentry *dentry, |
283 | const struct dentry *dentry, const struct inode *inode, | ||
284 | unsigned int len, const char *str, const struct qstr *name) | 273 | unsigned int len, const char *str, const struct qstr *name) |
285 | { | 274 | { |
286 | return isofs_dentry_cmp_common(len, str, name, 0, 0); | 275 | return isofs_dentry_cmp_common(len, str, name, 0, 0); |
287 | } | 276 | } |
288 | 277 | ||
289 | static int | 278 | static int |
290 | isofs_dentry_cmpi(const struct dentry *parent, const struct inode *pinode, | 279 | isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, |
291 | const struct dentry *dentry, const struct inode *inode, | ||
292 | unsigned int len, const char *str, const struct qstr *name) | 280 | unsigned int len, const char *str, const struct qstr *name) |
293 | { | 281 | { |
294 | return isofs_dentry_cmp_common(len, str, name, 0, 1); | 282 | return isofs_dentry_cmp_common(len, str, name, 0, 1); |
@@ -296,30 +284,26 @@ isofs_dentry_cmpi(const struct dentry *parent, const struct inode *pinode, | |||
296 | 284 | ||
297 | #ifdef CONFIG_JOLIET | 285 | #ifdef CONFIG_JOLIET |
298 | static int | 286 | static int |
299 | isofs_hash_ms(const struct dentry *dentry, const struct inode *inode, | 287 | isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) |
300 | struct qstr *qstr) | ||
301 | { | 288 | { |
302 | return isofs_hash_common(dentry, qstr, 1); | 289 | return isofs_hash_common(dentry, qstr, 1); |
303 | } | 290 | } |
304 | 291 | ||
305 | static int | 292 | static int |
306 | isofs_hashi_ms(const struct dentry *dentry, const struct inode *inode, | 293 | isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr) |
307 | struct qstr *qstr) | ||
308 | { | 294 | { |
309 | return isofs_hashi_common(dentry, qstr, 1); | 295 | return isofs_hashi_common(dentry, qstr, 1); |
310 | } | 296 | } |
311 | 297 | ||
312 | static int | 298 | static int |
313 | isofs_dentry_cmp_ms(const struct dentry *parent, const struct inode *pinode, | 299 | isofs_dentry_cmp_ms(const struct dentry *parent, const struct dentry *dentry, |
314 | const struct dentry *dentry, const struct inode *inode, | ||
315 | unsigned int len, const char *str, const struct qstr *name) | 300 | unsigned int len, const char *str, const struct qstr *name) |
316 | { | 301 | { |
317 | return isofs_dentry_cmp_common(len, str, name, 1, 0); | 302 | return isofs_dentry_cmp_common(len, str, name, 1, 0); |
318 | } | 303 | } |
319 | 304 | ||
320 | static int | 305 | static int |
321 | isofs_dentry_cmpi_ms(const struct dentry *parent, const struct inode *pinode, | 306 | isofs_dentry_cmpi_ms(const struct dentry *parent, const struct dentry *dentry, |
322 | const struct dentry *dentry, const struct inode *inode, | ||
323 | unsigned int len, const char *str, const struct qstr *name) | 307 | unsigned int len, const char *str, const struct qstr *name) |
324 | { | 308 | { |
325 | return isofs_dentry_cmp_common(len, str, name, 1, 1); | 309 | return isofs_dentry_cmp_common(len, str, name, 1, 1); |
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index c167028844ed..95295640d9c8 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -37,8 +37,7 @@ isofs_cmp(struct dentry *dentry, const char *compare, int dlen) | |||
37 | 37 | ||
38 | qstr.name = compare; | 38 | qstr.name = compare; |
39 | qstr.len = dlen; | 39 | qstr.len = dlen; |
40 | return dentry->d_op->d_compare(NULL, NULL, NULL, NULL, | 40 | return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); |
41 | dentry->d_name.len, dentry->d_name.name, &qstr); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | /* | 43 | /* |