Fix full_name_hash() behaviour when length is a multiple of 8
authorAl Viro <viro@ZenIV.linux.org.uk>
Thu, 22 Mar 2012 21:59:52 +0000 (21:59 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 22 Mar 2012 22:10:43 +0000 (15:10 -0700)
We want it to match what hash_name() is doing, which means extra
multiply by 9 in this case...

Reported-and-Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/namei.c

index a94a7f9a03eaf9d543fb32620c9a172fdb0c60ec..bd313d680d34ef466af23765413cbd709c540c98 100644 (file)
@@ -1439,10 +1439,10 @@ unsigned int full_name_hash(const unsigned char *name, unsigned int len)
 
        for (;;) {
                a = *(unsigned long *)name;
-               hash *= 9;
                if (len < sizeof(unsigned long))
                        break;
                hash += a;
+               hash *= 9;
                name += sizeof(unsigned long);
                len -= sizeof(unsigned long);
                if (!len)