aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-03-24 07:02:02 -0400
committerRussell King <rmk+kernel@armlinux.org.uk>2019-05-31 05:31:00 -0400
commit2eb0684f977123bfa5a565a57d219870085b78e8 (patch)
treec34b4ed251a6a2ab3b5ad8c71fc7b3fc5f0f3957
parentadb514a4e0f6d87ff43d1bc0a948c38530a0dc83 (diff)
fs/adfs: remove truncated filename hashing
fs/adfs support for truncated filenames is broken, and there is a desire not to support this into the future. Let's remove the fs/adfs support for this. Viro says: "FWIW, the word from Linus had been basically "kill it off" on truncation." That being: "Make it so. Make the rule be that d_hash() can only change the hash itself, rather than the subtle special case for len that we had because of legacy reasons.." Acked-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--fs/adfs/dir.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 877d5cffe9e9..5d88108339df 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -214,22 +214,17 @@ const struct file_operations adfs_dir_operations = {
214static int 214static int
215adfs_hash(const struct dentry *parent, struct qstr *qstr) 215adfs_hash(const struct dentry *parent, struct qstr *qstr)
216{ 216{
217 const unsigned int name_len = ADFS_SB(parent->d_sb)->s_namelen;
218 const unsigned char *name; 217 const unsigned char *name;
219 unsigned long hash; 218 unsigned long hash;
220 int i; 219 u32 len;
221 220
222 if (qstr->len < name_len) 221 if (qstr->len > ADFS_SB(parent->d_sb)->s_namelen)
223 return 0; 222 return -ENAMETOOLONG;
224 223
225 /* 224 len = qstr->len;
226 * Truncate the name in place, avoids
227 * having to define a compare function.
228 */
229 qstr->len = i = name_len;
230 name = qstr->name; 225 name = qstr->name;
231 hash = init_name_hash(parent); 226 hash = init_name_hash(parent);
232 while (i--) 227 while (len--)
233 hash = partial_name_hash(adfs_tolower(*name++), hash); 228 hash = partial_name_hash(adfs_tolower(*name++), hash);
234 qstr->hash = end_name_hash(hash); 229 qstr->hash = end_name_hash(hash);
235 230