public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Manish Katiyar" <mkatiyar@gmail.com>
To: linux-ext4@vger.kernel.org, "Theodore Tso" <tytso@mit.edu>
Subject: Re: [PATCH] libext2fs : Fix the return values for ino=0 in ext2fs_read_inode_full() if inode cache has been flushed.
Date: Tue, 15 Jul 2008 10:40:22 +0530	[thread overview]
Message-ID: <ea11fea30807142210w1dbc8f6aq59d3a295ab31a653@mail.gmail.com> (raw)
In-Reply-To: <ea11fea30807120657l2de0b501qefb45231edd5fac0@mail.gmail.com>

On Sat, Jul 12, 2008 at 7:27 PM, Manish Katiyar <mkatiyar@gmail.com> wrote:
> Hi Ted,
>
> It looks like the right place to check for ino=0 in
> ext2fs_read_inode_full() is before creating the inode cache, otherwise
> since we set icache[i].ino = 0 in create_icache(), it will match the
> loop below and thus we return a wrong value. Below patch fixes it.
>
> ==========================================================================
>
> Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>
>
> ---
>  lib/ext2fs/inode.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
> index 8908423..a08cb40 100644
> --- a/lib/ext2fs/inode.c
> +++ b/lib/ext2fs/inode.c
> @@ -536,6 +536,8 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs,
> ext2_ino_t ino,
>                if (retval != EXT2_ET_CALLBACK_NOTHANDLED)
>                        return retval;
>        }
> +       if ((ino == 0) || (ino > fs->super->s_inodes_count))
> +               return EXT2_ET_BAD_INODE_NUM;
>        /* Create inode cache if not present */
>        if (!fs->icache) {
>                retval = create_icache(fs);
> @@ -552,8 +554,6 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs,
> ext2_ino_t ino,
>                        }
>                }
>        }
> -       if ((ino == 0) || (ino > fs->super->s_inodes_count))
> -               return EXT2_ET_BAD_INODE_NUM;
>        if (fs->flags & EXT2_FLAG_IMAGE_FILE) {
>                inodes_per_block = fs->blocksize / EXT2_INODE_SIZE(fs->super);
>                block_nr = fs->image_header->offset_inode / fs->blocksize;
> --
> 1.5.4.3
>
>
> =====================================================================
>

Any ack/nack on this ?


> Thanks -
> Manish
>

  reply	other threads:[~2008-07-15  5:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-12 13:57 [PATCH] libext2fs : Fix the return values for ino=0 in ext2fs_read_inode_full() if inode cache has been flushed Manish Katiyar
2008-07-15  5:10 ` Manish Katiyar [this message]
2008-07-19 14:49   ` Theodore Tso

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=ea11fea30807142210w1dbc8f6aq59d3a295ab31a653@mail.gmail.com \
    --to=mkatiyar@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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