From: liubaolin <liubaolin12138@163.com>
To: Hongling Zeng <zenghongling@kylinos.cn>,
linkinjeon@kernel.org, hyc.lee@gmail.com
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org,
zhongling0719@126.com, stable@vger.kernel.org
Subject: Re: [PATCH v3 3/3] ntfs: NULL vol->vol_ino in the load_system_files() error teardown
Date: Tue, 8 Sep 2026 12:38:06 +0800 [thread overview]
Message-ID: <49ad7078-dbd9-44c4-b824-21fe0c0cede6@163.com> (raw)
In-Reply-To: <20260907070852.291323-4-zenghongling@kylinos.cn>
在 2026/9/7 15:08, Hongling Zeng 写道:
> The error unwind of load_system_files() drops vol->vol_ino on two
> paths but leaves the stale pointer in place while it keeps iput()ing
> the remaining system inodes ($Bitmap, $MFT bitmap, $MFTMirr; $MFT
> itself is dropped by the caller, ntfs_fill_super()). A third path
> carried an iput() that can never execute: it sits inside the
> IS_ERR(vol->vol_ino) branch guarded by !IS_ERR(vol->vol_ino), and is
> removed along with the stale pointers. Nothing in the teardown
> dereferences vol_ino today, so this is pure hygiene, but a stale
> pointer to a freed inode surviving the unwind is a trap for any
> future code walking the volume during teardown.
>
> ntfs_put_super() and the ntfs_fill_super() error path already NULL it
> after their iput(); do the same here.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
> fs/ntfs/super.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
> index 4b4af1ea8b09..2d4132aa39d3 100644
> --- a/fs/ntfs/super.c
> +++ b/fs/ntfs/super.c
> @@ -1541,8 +1541,7 @@ static bool load_system_files(struct ntfs_volume *vol)
> */
> vol->vol_ino = ntfs_iget(sb, FILE_Volume);
> if (IS_ERR(vol->vol_ino)) {
> - if (!IS_ERR(vol->vol_ino))
> - iput(vol->vol_ino);
> + vol->vol_ino = NULL;
> volume_failed:
> ntfs_error(sb, "Failed to load $Volume.");
> goto iput_lcnbmp_err_out;
> @@ -1551,6 +1550,7 @@ static bool load_system_files(struct ntfs_volume *vol)
> if (IS_ERR(m)) {
> iput_volume_failed:
> iput(vol->vol_ino);
> + vol->vol_ino = NULL;
> goto volume_failed;
> }
>
> @@ -1716,6 +1716,8 @@ static bool load_system_files(struct ntfs_volume *vol)
> if (vol->logfile_ino)
> iput(vol->logfile_ino);
> iput(vol->vol_ino);
> + /* Do not leave a stale pointer behind for the rest of the teardown. */
> + vol->vol_ino = NULL;
> iput_lcnbmp_err_out:
> iput(vol->lcnbmp_ino);
> iput_attrdef_err_out:
Looks good to me.
Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>
next prev parent reply other threads:[~2026-09-08 4:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 7:08 [PATCH v3 0/3] ntfs: fix volume flag update races and persist the recorded error state Hongling Zeng
2026-09-07 7:08 ` [PATCH v3 1/3] ntfs: fix volume flag update races Hongling Zeng
2026-09-08 5:29 ` liubaolin
2026-09-08 9:36 ` Hongling Zeng
2026-09-07 7:08 ` [PATCH v3 2/3] ntfs: sync the volume dirty bit with the recorded error state Hongling Zeng
2026-09-08 4:10 ` Namjae Jeon
2026-09-08 7:20 ` Hongling Zeng
2026-09-08 5:23 ` liubaolin
2026-09-08 9:22 ` Hongling Zeng
2026-09-07 7:08 ` [PATCH v3 3/3] ntfs: NULL vol->vol_ino in the load_system_files() error teardown Hongling Zeng
2026-09-08 4:38 ` liubaolin [this message]
2026-09-08 9:42 ` Namjae Jeon
2026-09-08 4:32 ` [PATCH v3 0/3] ntfs: fix volume flag update races and persist the recorded error state liubaolin
-- strict thread matches above, loose matches on Subject: below --
2026-09-09 2:48 [PATCH v4 0/4] " Hongling Zeng
2026-09-09 2:48 ` [PATCH v3 3/3] ntfs: NULL vol->vol_ino in the load_system_files() error teardown Hongling Zeng
2026-09-07 6:22 [PATCH v3 0/3] ntfs: fix volume flag update races and persist the recorded error state Hongling Zeng
2026-09-07 6:22 ` [PATCH v3 3/3] ntfs: NULL vol->vol_ino in the load_system_files() error teardown Hongling Zeng
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=49ad7078-dbd9-44c4-b824-21fe0c0cede6@163.com \
--to=liubaolin12138@163.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=zenghongling@kylinos.cn \
--cc=zhongling0719@126.com \
/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
all inboxes | Powered by JetHome®