stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Richard Cochran <richardcochran@gmail.com>
Cc: <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejun Heo <tj@kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] kernfs: fix off by one error.
Date: Wed, 05 Mar 2014 09:11:17 -0800	[thread overview]
Message-ID: <877g887eq2.fsf@xmission.com> (raw)
In-Reply-To: <74f5a436ebf5c13ed89a81c47ba09a6549e385f6.1394035568.git.richardcochran@gmail.com> (Richard Cochran's message of "Wed, 5 Mar 2014 17:10:52 +0100")

Richard Cochran <richardcochran@gmail.com> writes:

> 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.
>
Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>
> 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;

  reply	other threads:[~2014-03-05 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 16:10 [PATCH] kernfs: fix off by one error Richard Cochran
2014-03-05 17:11 ` Eric W. Biederman [this message]
2014-03-05 18:30 ` Greg Kroah-Hartman
2014-03-05 18:34   ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877g887eq2.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).