public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: 0xkato <0xkkato@gmail.com>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	Sasha Levin <sashal@kernel.org>,
	ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 7.0-6.1] ntfs3: fix OOB write in attr_wof_frame_info()
Date: Tue, 28 Apr 2026 06:41:01 -0400	[thread overview]
Message-ID: <20260428104133.2858589-50-sashal@kernel.org> (raw)
In-Reply-To: <20260428104133.2858589-1-sashal@kernel.org>

From: 0xkato <0xkkato@gmail.com>

[ Upstream commit 859d777646b56dd878b136392f3d03fb8153b559 ]

In attr_wof_frame_info(), the offset-table read range for a nonresident
WofCompressedData stream is:

    u64 from = vbo[i] & ~(u64)(PAGE_SIZE - 1);
    u64 to   = min(from + PAGE_SIZE, wof_size);
    ...
    ntfs_read_run(sbi, run, addr, from, to - from);

A crafted image sets WofCompressedData.nres.data_size to 0xfff while the
file is large enough to request frame 1024 (offset 0x400000). This gives
from=0x1000, to=0xfff. The unsigned (to - from) wraps to 0xffffffffffffffff
and ntfs_read_write_run() overflows the single-page offs_folio via memcpy.

Triggered by pread() on a mounted NTFS image. Depending on adjacent
memory layout at the time of the overflow, KASAN reports this as
slab-out-of-bounds, use-after-free, or slab-use-after-free all at
ntfs_read_write_run(). Secondary corruption/panic paths were also observed.

Reject the read when the offset-table page is outside the stream.

Signed-off-by: 0xkato <0xkkato@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:



 fs/ntfs3/attrib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index 6cb9bc5d605c2..89921e5091c9a 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -1576,6 +1576,12 @@ int attr_wof_frame_info(struct ntfs_inode *ni, struct ATTRIB *attr,
 			u64 from = vbo[i] & ~(u64)(PAGE_SIZE - 1);
 			u64 to = min(from + PAGE_SIZE, wof_size);
 
+			if (from >= wof_size) {
+				_ntfs_bad_inode(&ni->vfs_inode);
+				err = -EINVAL;
+				goto out1;
+			}
+
 			err = attr_load_runs_range(ni, ATTR_DATA, WOF_NAME,
 						   ARRAY_SIZE(WOF_NAME), run,
 						   from, to);
-- 
2.53.0


  parent reply	other threads:[~2026-04-28 10:42 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 10:40 [PATCH AUTOSEL 7.0] ALSA: hda/realtek: add quirk for HONOR MRB-XXX M1020 Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] tools/power/x86/intel-speed-select: Avoid current base freq as maximum Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] um: fix address-of CMSG_DATA() rvalue in stub Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] tty: serial: samsung_tty: avoid dev_dbg deadlock Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] drm/amdgpu: fix CPER ring header parsing Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] io_uring/rsrc: unify nospec indexing for direct descriptors Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] um: avoid struct sigcontext redefinition with musl Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.15] leds: lgm-sso: Fix typo in macro for src offset Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.15] fs/ntfs3: increase CLIENT_REC name field size Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.15] ksmbd: fix CreateOptions sanitization clobbering the whole field Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.1] thunderbolt: Disable CLx on Titan Ridge-based devices with old firmware Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.6] NFS: Use nlmclnt_shutdown_rpc_clnt() to safely shut down NLM Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] smb: client: compress: fix buffer overrun in lz77_compress() Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] drm/amd/display: Pass min page size from SOC BB to dml2_1 plane config Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] usb: dwc3: Support USB3340x ULPI PHY high-speed negotiation Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] smb: client: compress: fix counting in LZ77 match finding Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] mfd: mt6397: Properly fix CID of MT6328, MT6331 and MT6332 Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.1] um: Disable GCOV_PROFILE_ALL on 32-bit UML with Clang 20/21 Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] ASoC: qcom: x1e80100: limit speaker volumes Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] smb: client: compress: fix bad encoding on last LZ77 flag Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.15] fs/ntfs3: fix potential double iput on d_make_root() failure Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] scsi: storvsc: Handle PERSISTENT_RESERVE_IN truncation for Hyper-V vFC Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0] fs: aio: set VMA_DONTCOPY_BIT in mmap to fix NULL-pointer-dereference error Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] dt-bindings: arm64: add Marvell 7k COMe boards Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] ecryptfs: Set s_time_gran to get correct time granularity Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] usb: usbip: fix OOB read/write in usbip_pad_iso() Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] scsi: lpfc: Remove unnecessary ndlp kref get in lpfc_check_nlp_post_devloss Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] leds: core: Implement fallback to software node name for LED names Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.15] ntfs3: reject inodes with zero non-DOS link count Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] f2fs: fix to skip empty sections in f2fs_get_victim Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0] NFS: fix writeback in presence of errors Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.6] dt-bindings: rtc: microcrystal,rv3028: Allow to specify vdd-supply Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] fs: aio: reject partial mremap to avoid Null-pointer-dereference error Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.15] fs/ntfs3: fix $LXDEV xattr lookup Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] scsi: ufs: ufs-pci: Add support for Intel Nova Lake Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.1] scsi: lpfc: Fix incorrect txcmplq_cnt during cleanup in lpfc_sli_abort_ring() Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.18] drm/amdgpu: drop userq fence driver refs out of fence process() Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.15] ksmbd: fix O(N^2) DoS in smb2_lock via unbounded LockCount Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] usb: gadget: bdc: validate status-report endpoint indices Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] coda_flag_children(): fix a UAF Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] fbdev: savage: fix probe-path EDID cleanup leaks Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0] scsi: virtio_scsi: Move INIT_WORK calls to virtscsi_probe() Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] iio: ABI: fix current_trigger description Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] staging: octeon: fix free_irq dev_id mismatch in cvm_oct_rx_shutdown Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] mfd: intel-lpss: Add Intel Nova Lake-H PCI IDs Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] tty: serial: imx: keep dma request disabled before dma transfer setup Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-6.12] greybus: beagleplay: bound bootloader RX buffer copy Sasha Levin
2026-04-28 10:40 ` [PATCH AUTOSEL 7.0-5.10] serial: qcom-geni: Fix RTS behavior with flow control Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] selftests: fib_nexthops: test stale has_v4 on nexthop replace Sasha Levin
2026-04-28 10:41 ` Sasha Levin [this message]
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] arm64: cputype: Add C1-Pro definitions Sasha Levin
2026-04-28 11:13   ` Mark Rutland
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.18] drm/amd/display: Fix HostVMMinPageSize unit mismatch in DML2.1 Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.12] 9p/trans_xen: make cleanup idempotent after dataring alloc errors Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0] drm/amdgpu: OR init_pte_flags into invalid leaf PTE updates Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.6] scsi: ufs: core: Disable timestamp for Kioxia THGJFJT0E25BAIP Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.18] f2fs: fix to freeze GC and discard threads quickly Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] scsi: esas2r: Fix __printf annotation on esas2r_log_master() Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.18] rtc: max77686: convert to i2c_new_ancillary_device Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.1] rtc: ti-k3: Add support to resume from IO DDR low power mode Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.12] bus: mhi: host: pci_generic: Add Telit FE912C04 modem support Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] usb: usbip: fix integer overflow in usbip_recv_iso() Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] clk: qcom: rcg2: expand frac table for mdss_pixel_clk_src Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] usb: usbip: validate iso frame actual_length in usbip_recv_iso() Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.12] bus: mhi: host: pci_generic: Add Qualcomm SDX35 modem Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0] drm/amd/display: Use overlay cursor when color pipeline is active Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.18] platform/x86: hp-wmi: Add support for Omen 16-wf1xxx (8C77) Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.12] smb: server: stop sending fake security descriptors Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.18] ALSA: usb-audio: Add quirk entries for NexiGo N930W webcam Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.15] ntfs3: fix memory leak in indx_create_allocate() Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] staging: fbtft: fix unchecked write return value in fb_agm1264k-fl Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.10] ipv6: Cap TLV scan in ip6_tnl_parse_tlv_enc_lim Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.18] scsi: lpfc: Add PCI ID support for LPe42100 series adapters Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.12] io_uring: take page references for NOMMU pbuf_ring mmaps Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-6.18] iio: imu: st_lsm6dsx: Add ACPI ID for SHIFT13mi gyroscope Sasha Levin
2026-04-28 10:41 ` [PATCH AUTOSEL 7.0-5.15] dt-bindings: clock: qcom,gcc-sc8180x: Add missing GDSCs Sasha Levin

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=20260428104133.2858589-50-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=0xkkato@gmail.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=patches@lists.linux.dev \
    --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