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>
This commit is contained in:
parent
adb514a4e0
commit
2eb0684f97
|
@ -214,22 +214,17 @@ const struct file_operations adfs_dir_operations = {
|
||||||
static int
|
static int
|
||||||
adfs_hash(const struct dentry *parent, struct qstr *qstr)
|
adfs_hash(const struct dentry *parent, struct qstr *qstr)
|
||||||
{
|
{
|
||||||
const unsigned int name_len = ADFS_SB(parent->d_sb)->s_namelen;
|
|
||||||
const unsigned char *name;
|
const unsigned char *name;
|
||||||
unsigned long hash;
|
unsigned long hash;
|
||||||
int i;
|
u32 len;
|
||||||
|
|
||||||
if (qstr->len < name_len)
|
if (qstr->len > ADFS_SB(parent->d_sb)->s_namelen)
|
||||||
return 0;
|
return -ENAMETOOLONG;
|
||||||
|
|
||||||
/*
|
len = qstr->len;
|
||||||
* Truncate the name in place, avoids
|
|
||||||
* having to define a compare function.
|
|
||||||
*/
|
|
||||||
qstr->len = i = name_len;
|
|
||||||
name = qstr->name;
|
name = qstr->name;
|
||||||
hash = init_name_hash(parent);
|
hash = init_name_hash(parent);
|
||||||
while (i--)
|
while (len--)
|
||||||
hash = partial_name_hash(adfs_tolower(*name++), hash);
|
hash = partial_name_hash(adfs_tolower(*name++), hash);
|
||||||
qstr->hash = end_name_hash(hash);
|
qstr->hash = end_name_hash(hash);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue