* Bug in fs/kernfs/dir.c comment or code?
@ 2014-03-02 20:16 Richard Cochran
2014-03-03 22:43 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Richard Cochran @ 2014-03-02 20:16 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel
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?
Thanks,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug in fs/kernfs/dir.c comment or code?
2014-03-02 20:16 Bug in fs/kernfs/dir.c comment or code? Richard Cochran
@ 2014-03-03 22:43 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2014-03-03 22:43 UTC (permalink / raw)
To: Richard Cochran; +Cc: linux-kernel, Greg Kroah-Hartman, Eric Biederman
(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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-03 22:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-02 20:16 Bug in fs/kernfs/dir.c comment or code? Richard Cochran
2014-03-03 22:43 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox