mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Goergens <matthias.goergens@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>, Hyunchul Lee <hyc.lee@gmail.com>
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] ntfs: fix the undo path of $MFT data extension
Date: Wed, 30 Sep 2026 11:35:54 +0800	[thread overview]
Message-ID: <20260930033556.169300-1-matthias.goergens@gmail.com> (raw)

These fix two bugs in the undo path of
ntfs_mft_data_extend_allocation_nolock(): patch 1 makes its $MFT
runlist locking consistent, and patch 2 fixes a use-after-free of a
pointer into the runlist across the truncation.

Both paths only run when something fails while $MFT grows, so I tested
them in QEMU by forcing each failure once with a debug patch.  The
debug patch, the test scripts and the images are at
https://github.com/matthiasgoergens/linux/tree/reproducer/2026-09-28-ntfs-mft-extend-undo-v2

Changes in v2:
- Patch 1: if ntfs_rl_truncate_nolock() fails, keep the clusters
  allocated instead of freeing them, as the runlist may still reference
  them (Hyunchul Lee).  The truncation cannot fail at this call site
  today, but with a failure forced, v1 freed clusters that $MFT's
  runlist still mapped and later handed them to a data file.
- Patch 1: did not carry over Baolin Liu's Reviewed-by, as the patch
  changed.
- Patch 2: unchanged.

v1: https://lore.kernel.org/all/20260927105706.3111333-1-matthias.goergens@gmail.com/

Thanks,
Matthias

Matthias Goergens (2):
  ntfs: balance the $MFT runlist lock in data extension error paths
  ntfs: do not use a stale runlist pointer when undoing $MFT extension

 fs/ntfs/mft.c | 68 +++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 58 insertions(+), 10 deletions(-)


base-commit: 259abb551e2944998cad4214c201954ab1ac5c8d
-- 
2.55.0


             reply	other threads:[~2026-09-30  3:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  3:35 Matthias Goergens [this message]
2026-09-30  3:35 ` [PATCH v2 1/2] ntfs: balance the $MFT runlist lock in data extension error paths Matthias Goergens
2026-09-30  8:14   ` Hyunchul Lee
2026-09-30  3:35 ` [PATCH v2 2/2] ntfs: do not use a stale runlist pointer when undoing $MFT extension Matthias Goergens

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=20260930033556.169300-1-matthias.goergens@gmail.com \
    --to=matthias.goergens@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs@lists.linux.dev \
    /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®