[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <0E811115-22DB-4D20-AE03-428037E1429C@dilger.ca>
Date: Wed, 13 Oct 2010 12:56:33 -0600
From: Andreas Dilger <adilger@...ger.ca>
To: Eric Sandeen <sandeen@...hat.com>
Cc: Roman Borisov <ext-roman.borisov@...ia.com>,
linux-ext4@...r.kernel.org
Subject: Re: ext3: ext4: Using uninitialized value
On 2010-10-13, at 10:13, Eric Sandeen wrote:
> On 10/13/2010 09:40 AM, Roman Borisov wrote:
>> Hello,
>>
>> Could you clarify is there a bug in fs/ext4/namei.c,
>> ext4_dx_find_entry() and fs/ext4/namei.c, ext3_dx_find_entry()?
>
> that was introduced with:
>
> commit acfa1823d33859b0db77701726c9ca5ccc6e6f25
> Author: Andreas Dilger <adilger@...sterfs.com>
> Date: Thu Jun 23 00:09:45 2005 -0700
>
> [PATCH] Support for dx directories in ext3_get_parent (NFSD)
>
> so maybe Andreas knows offhand ;) but I think:
Your analysis is correct. I agree it's a bit convoluted, but it avoids replicating a bunch of code.
>> static struct buffer_head * ext3_dx_find_entry(struct inode *dir,
>> ...
>> if (namelen > 2 || name[0] != '.'|| (namelen == 2 && name[1] != '.'))
>> } else {
>
> so here it -is- "." or ".." -
>
>> frame = frames;
>> frame->bh = NULL; /* for dx_release() */
>> frame->at = (struct dx_entry *)frames; /* hack for zero entry*/
>> dx_set_block(frame->at, 0); /* dx_root block is 0 */
>> if (!(bh = ext3_bread (NULL,dir, block, 0, err)))
>> goto errout;
>
> so we look up block 0 in the dir inode
>
>> if (ext3_match(namelen, name, de)) {
>
> here we should find the . or .. (it's always going to be there, right?)
Right - it is important to note that the index root block is a "fake" directory block which has just the "." and ".." entries at the beginning (with the ".." spanning the rest of the block), and the rest of the block is holding the index entries. For a directory index to even exist, it HAS to have the "." and ".." entries in the first block, or there is no place to put the index.
Cheers, Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists