stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernfs: fix off by one error.
@ 2014-03-05 16:10 Richard Cochran
  2014-03-05 17:11 ` Eric W. Biederman
  2014-03-05 18:30 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Cochran @ 2014-03-05 16:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Eric Biederman, Tejun Heo, stable

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>
---
 fs/kernfs/dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index bd6e18b..39c0143 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -37,7 +37,7 @@ static unsigned int kernfs_name_hash(const char *name, const void *ns)
 	hash = (end_name_hash(hash) ^ hash_ptr((void *)ns, 31));
 	hash &= 0x7fffffffU;
 	/* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */
-	if (hash < 1)
+	if (hash < 2)
 		hash += 2;
 	if (hash >= INT_MAX)
 		hash = INT_MAX - 1;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-05 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 16:10 [PATCH] kernfs: fix off by one error Richard Cochran
2014-03-05 17:11 ` Eric W. Biederman
2014-03-05 18:30 ` Greg Kroah-Hartman
2014-03-05 18:34   ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).