From: ebiederm@xmission.com (Eric W. Biederman)
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Cochran <richardcochran@gmail.com>,
linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] kernfs: fix off by one error.
Date: Wed, 05 Mar 2014 10:34:38 -0800 [thread overview]
Message-ID: <87k3c8ze81.fsf@xmission.com> (raw)
In-Reply-To: <20140305183042.GC9824@kroah.com> (Greg Kroah-Hartman's message of "Wed, 5 Mar 2014 10:30:42 -0800")
Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> On Wed, Mar 05, 2014 at 05:10:52PM +0100, Richard Cochran wrote:
>> 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(-)
>
> Is this for 3.14-final or 3.15-rc1?
The bug has existed since I added that hash function in 3.4-rc1. It was
named sysfs_name_hash then but the code has otherwise been unchanged.
It is a very minor bug.
commit 4e4d6d860b9393c5395ba5920edb5b4c5d43a3a3
Author: Eric W. Biederman <ebiederm@xmission.com>
Date: Sun Dec 18 20:05:43 2011 -0800
sysfs: Add s_hash to sysfs_dirent and order directory entries by hash
Compute a 31 bit hash of directory entries (that can fit in a signed
32bit off_t) and index the sysfs directory entries by that hash,
replacing the per directory indexes by name and by inode. Because we
now only use a single rbtree this reduces the size of sysfs_dirent by 2
pointers. Because we have fewer cases to deal with the code is now
simpler.
For now I use the simple hash that the dcache uses as that is easy to
use and seems simple enough.
In addition to makeing the code simpler using a hash for the file
position in readdir brings sysfs in line with other filesystems that
have non-trivial directory structures.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Eric
prev parent reply other threads:[~2014-03-05 18:34 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
2014-03-05 18:30 ` Greg Kroah-Hartman
2014-03-05 18:34 ` Eric W. Biederman [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=87k3c8ze81.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).