From: Eric Sandeen <sandeen@redhat.com>
To: Roman Borisov <ext-roman.borisov@nokia.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: ext3: ext4: Using uninitialized value
Date: Wed, 13 Oct 2010 11:13:55 -0500 [thread overview]
Message-ID: <4CB5DAC3.3040605@redhat.com> (raw)
In-Reply-To: <4CB5C4D6.3020201@nokia.com>
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@clusterfs.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:
> <code>
> static struct buffer_head * ext3_dx_find_entry(struct inode *dir,
> ...
> if (namelen > 2 || name[0] != '.'|| (namelen == 2 && name[1] != '.')) {
This is a fancy way of saying name is not "." or ".."
> if (!(frame = dx_probe(entry, dir, &hinfo, frames, err)))
> return NULL;
> } 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 */
now frame->at.block = 0
> }
> hash = hinfo.hash;
> do {
> block = dx_get_block(frame->at);
block = 0 (we just put it there)
> if (!(bh = ext3_bread (NULL,dir, block, 0, err)))
> goto errout;
so we look up block 0 in the dir inode
> de = (struct ext3_dir_entry_2 *) bh->b_data;
> top = (struct ext3_dir_entry_2 *) ((char *) de + sb->s_blocksize -
> EXT3_DIR_REC_LEN(0));
and get to the dir entry, and search through them for our name
> for (; de < top; de = ext3_next_entry(de)) {
> int off = (block << EXT3_BLOCK_SIZE_BITS(sb))
> + ((char *) de - bh->b_data);
>
> if (!ext3_check_dir_entry(__func__, dir, de, bh, off)) {
> brelse(bh);
> *err = ERR_BAD_DX_DIR;
> goto errout;
> }
>
> if (ext3_match(namelen, name, de)) {
here we should find the . or .. (it's always going to be there, right?)
> *res_dir = de;
> dx_release(frames);
> return bh;
so we return
> }
> }
before we get here:
> ...
> retval = ext3_htree_next_block(dir, hash, frame,
> frames, NULL);
> ...
> </code>
-Eric
> In the code above: hinfo.hash is not initialized in "else" case.
> Should it be initialized as NULL?
> Or maybe implementation doesn't assume to call ext3_htree_next_block()
> in such case?
>
> Thanks,
> Roman
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-10-13 16:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-13 14:40 ext3: ext4: Using uninitialized value Roman Borisov
2010-10-13 16:13 ` Eric Sandeen [this message]
2010-10-13 18:56 ` Andreas Dilger
2010-10-14 10:10 ` Roman Borisov
2010-10-14 13:42 ` Eric Sandeen
2010-10-16 23:35 ` Ted Ts'o
2010-10-16 23:36 ` [PATCH 1/2] ext3: Avoid uninitialized memory references with a corrupted htree directory Theodore Ts'o
2010-10-18 10:05 ` Jan Kara
2010-10-19 7:12 ` Andreas Dilger
2010-10-16 23:37 ` [PATCH 2/2] ext3: Use search_dirblock() in ext3_dx_find_entry() Theodore Ts'o
2010-10-16 23:37 ` [PATCH 1/2] ext4: Avoid uninitialized memory references in ext3_htree_next_block() Theodore Ts'o
2010-10-18 4:27 ` Andreas Dilger
2010-10-16 23:37 ` [PATCH 2/2] ext4: Use search_dirblock() in ext4_dx_find_entry() Theodore Ts'o
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=4CB5DAC3.3040605@redhat.com \
--to=sandeen@redhat.com \
--cc=ext-roman.borisov@nokia.com \
--cc=linux-ext4@vger.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).