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/efivarfs/super.c | |
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/efivarfs/super.c')
-rw-r--r-- | fs/efivarfs/super.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 141aee31884f..a8766b880c07 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c | |||
@@ -45,8 +45,8 @@ static struct super_block *efivarfs_sb; | |||
45 | * So we need to perform a case-sensitive match on part 1 and a | 45 | * So we need to perform a case-sensitive match on part 1 and a |
46 | * case-insensitive match on part 2. | 46 | * case-insensitive match on part 2. |
47 | */ | 47 | */ |
48 | static int efivarfs_d_compare(const struct dentry *parent, const struct inode *pinode, | 48 | static int efivarfs_d_compare(const struct dentry *parent, |
49 | const struct dentry *dentry, const struct inode *inode, | 49 | const struct dentry *dentry, |
50 | unsigned int len, const char *str, | 50 | unsigned int len, const char *str, |
51 | const struct qstr *name) | 51 | const struct qstr *name) |
52 | { | 52 | { |
@@ -63,8 +63,7 @@ static int efivarfs_d_compare(const struct dentry *parent, const struct inode *p | |||
63 | return strncasecmp(name->name + guid, str + guid, EFI_VARIABLE_GUID_LEN); | 63 | return strncasecmp(name->name + guid, str + guid, EFI_VARIABLE_GUID_LEN); |
64 | } | 64 | } |
65 | 65 | ||
66 | static int efivarfs_d_hash(const struct dentry *dentry, | 66 | static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) |
67 | const struct inode *inode, struct qstr *qstr) | ||
68 | { | 67 | { |
69 | unsigned long hash = init_name_hash(); | 68 | unsigned long hash = init_name_hash(); |
70 | const unsigned char *s = qstr->name; | 69 | const unsigned char *s = qstr->name; |
@@ -108,7 +107,7 @@ static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) | |||
108 | q.name = name; | 107 | q.name = name; |
109 | q.len = strlen(name); | 108 | q.len = strlen(name); |
110 | 109 | ||
111 | err = efivarfs_d_hash(NULL, NULL, &q); | 110 | err = efivarfs_d_hash(NULL, &q); |
112 | if (err) | 111 | if (err) |
113 | return ERR_PTR(err); | 112 | return ERR_PTR(err); |
114 | 113 | ||