mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Richard Cochran <richardcochran@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Eric Biederman <ebiederm@xmission.com>
Subject: Re: Bug in fs/kernfs/dir.c comment or code?
Date: Mon, 3 Mar 2014 17:43:45 -0500	[thread overview]
Message-ID: <20140303224345.GD26523@mtj.dyndns.org> (raw)
In-Reply-To: <20140302201656.GA5659@netboy>

(cc'ing Greg and Eric)

On Sun, Mar 02, 2014 at 09:16:58PM +0100, Richard Cochran wrote:
> I stumbled across this in fs/kernfs/dir.c:39.
> 
> 	/* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */
> 	if (hash < 1)
> 		hash += 2;
> 	if (hash >= INT_MAX)
> 		hash = INT_MAX - 1;
> 
> Shouldn't that be (hash < 2), or is 1 not reserved?

Looks like the code is wrong and the condition should be hash < 2.
Difficult to trigger but an actual bug.  The fix should probably be
propagated to sysfs through -stable.  Can you write up a patch?

Thanks.

-- 
tejun

      reply	other threads:[~2014-03-03 22:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 20:16 Richard Cochran
2014-03-03 22:43 ` Tejun Heo [this message]

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=20140303224345.GD26523@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /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

all inboxes | Powered by JetHome®