diff options
author | Richard Cochran <richardcochran@gmail.com> | 2014-03-05 11:10:52 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-09 01:08:29 -0500 |
commit | 88391d49abb7d8dee91d405f96bd9e003cb6798d (patch) | |
tree | 6e41448eb4131efd1708ebf674380b218ef2e24d /fs/kernfs | |
parent | 13df7977431e3b906a23bb75f29e0f40a8d73f87 (diff) |
kernfs: fix off by one error.
The hash values 0 and 1 are reserved for magic directory entries, but
the code only prevents names hashing to 0. This patch fixes the test
to also prevent hash value 1.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/dir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 8245d3b34894..0bd05ab26003 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -190,7 +190,7 @@ static unsigned int kernfs_name_hash(const char *name, const void *ns) | |||
190 | hash = (end_name_hash(hash) ^ hash_ptr((void *)ns, 31)); | 190 | hash = (end_name_hash(hash) ^ hash_ptr((void *)ns, 31)); |
191 | hash &= 0x7fffffffU; | 191 | hash &= 0x7fffffffU; |
192 | /* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */ | 192 | /* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */ |
193 | if (hash < 1) | 193 | if (hash < 2) |
194 | hash += 2; | 194 | hash += 2; |
195 | if (hash >= INT_MAX) | 195 | if (hash >= INT_MAX) |
196 | hash = INT_MAX - 1; | 196 | hash = INT_MAX - 1; |