linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Baokun Li <libaokun1@huawei.com>
Cc: "Luís Henriques" <lhenriques@suse.de>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] ext4: fix a NULL pointer when validating an inode bitmap
Date: Wed, 30 Nov 2022 23:32:10 -0500	[thread overview]
Message-ID: <Y4guSv6wHI1i+3Cz@mit.edu> (raw)
In-Reply-To: <a448e298-dffd-e2f5-79b9-3997a4f53c92@huawei.com>

On Wed, Nov 30, 2022 at 11:20:11AM +0800, Baokun Li wrote:
> > If we can protect against the problem by adding a check that has other
> > value as well (such as making usre that when ext4_iget fetches a
> > special inode, we enforce that i_links_couint must be > 0), maybe
> > that's worth it.
>
> Yes, but some special inodes allow i_links_couint to be zero,
> such as the uninitialized boot load inode.

That's a good point; but the only time when a special inode can
validly have a zero i_links_count is when it has no blocks associated
to it.  Otherwise, when the file system releases the inode using
iput() when the file system is unmounted, all of the blocks will get
released when the inode is evicted.  So we can have ext4_iget() allow
fetching an inode if i_blocks[] is zeros.  But if it has any blocks
and i_links_count is non-zero, something must be terribly wrong with
that inode.

Cheers,

					- Ted

  reply	other threads:[~2022-12-01  4:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 14:20 [PATCH] ext4: fix a NULL pointer when validating an inode bitmap Luís Henriques
2022-10-11 15:56 ` [PATCH v2] " Luís Henriques
2022-11-06  0:32   ` Theodore Ts'o
2022-11-08 14:06     ` Luís Henriques
2022-11-28 22:28       ` Theodore Ts'o
2022-11-29  3:18         ` Baokun Li
2022-11-29 21:00           ` Theodore Ts'o
2022-11-30  3:20             ` Baokun Li
2022-12-01  4:32               ` Theodore Ts'o [this message]
2022-12-01  6:20                 ` Baokun Li
2022-10-12 13:13 ` [PATCH v2] ext4: fix BUG_ON() when directory entry has invalid rec_len Luís Henriques
2022-10-12 13:16   ` Luís Henriques
2022-10-12 14:21     ` Theodore Ts'o
2022-10-12 15:18       ` Luís Henriques
2022-11-06  6:16   ` 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=Y4guSv6wHI1i+3Cz@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=lhenriques@suse.de \
    --cc=libaokun1@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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).