From nobody Sat May 30 09:29:55 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7A5940242A for ; Mon, 11 May 2026 17:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778519950; cv=none; b=Pia4CYIR4dbcEP2r0IMli9PkPlJUUuzwB/yRNl/CihlRC0AodW5+LCgANm/fs6IjZA8MkNtTzEu4mcTWvhtYkTBhProw2QnE6hmYKQE8TcqmXsucb93zauNdUvAwWaN/RDefpmtcj+xDRm7wl45GqeWR2Z1nlhPP1qoBspj/k0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778519950; c=relaxed/simple; bh=zaR2jVq6IFi9mbvaeshZVhZzW+4wk7HanSdPaJAwk0M=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=rOEHBMWvjgQtX7hycVutuZtCoiYNRnVffo2CKA03X6DxglrTS/77HNX4rajZ9jcozp/0SjdXSgfYMkD/gMZ+sLvCWiDOPZugaZH7r5jmfl6mXQrstq7IX5o+8txLPRFpYh/I0jb+WL5ePmygiSdTdWxA0uR2TpCVzHDin/95TAk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YbOYLjt6; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YbOYLjt6" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4891e5b9c1fso43669185e9.2 for ; Mon, 11 May 2026 10:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778519947; x=1779124747; darn=vger.kernel.org; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=U5YGkfJg6n4KiA/WQT6VRxvR8ouMJ6VVP5WZQs3IwGM=; b=YbOYLjt6SLoAguuwgkv/8/h3YMstbfEQhbBPKcfjc4fg2tVwc2lgi/F/e8yKcqp8fT wkW7pCOSr76HG9tR1U1AiI+McjIYd487M0K0FaT/V1wMgYyqVpaOtS2gAyKjs76il6B+ fGecUGD7sdjjrE4SfejFlN2NbPzZuN1qxETW2UryS3qImU/uDWAsCMaXPSPMcZUeSU9A +wGOrb8/pke+R3rr4ZpTX2dOWZy7BQhsPcRdY1zyHqikQ5ioPAYEESZfdULFhV27BXx5 jxD7FbPl6fZCHJfqXsR1S2G8YrokV2qa8XOdHbmNSEmqftEp7YEQGrvndduojW0h0ZbD FrRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778519947; x=1779124747; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=U5YGkfJg6n4KiA/WQT6VRxvR8ouMJ6VVP5WZQs3IwGM=; b=eRODYSlI1O8LQzctvopfwGgSUizt6bpCnMpQNbSGs4d9vo3sK2CAOTgHURtyNessa5 n2zo5YFK5sEcvNBQ3BT6aSSM/7hLjDJOJp2WPDd//K4CjplhpihBz2LAABLFiekPY21G ecz3iRQYCLHFK1t+UU0RlXmV5IR86KEYv2zA3xDJTjOPt87zUl0lENYztLdFcZ+ppfFT mwtkyiWtOEM0M+/N8PeSqTRGrX0oXGKFwzT2QOh0HwM6NdgqlTHe+sx/dRqzXRC80soS sIss8IiZk3Q5cazTt88udzd4MUca0L0yKE0quyX3R7nQAVZ5U1GU/r8Ox3MZCQoSk3+F 8eNw== X-Forwarded-Encrypted: i=1; AFNElJ+3ojHgO8j+aMiqrfvRP2n7rmcvAQpz59hZ6hsF94/CXU9T0kc7nXe3VKtbsjzKal1VhsncML+NOOzGIfU=@vger.kernel.org X-Gm-Message-State: AOJu0YyOnXT2E+Lwtp1IQFeo2uYehSWRVvNIO63K+mTksNMCHlZst+Us sKI8I1lcMMIBXg3MSatbduiZmynzmudGoTLg9sA/GjBd3JtXgOeeLh1V X-Gm-Gg: Acq92OHavtLLw9fMf/U4hin0bz6WUKrfAlGbl6t9KVo0i1VpgjJ32xzh6TAP18AC232 YWvAfX1kBiXsR7jHKxBpk5tQOhYxmJvLdOQrnbFqNjQxBhb6+s3bEnjyLk6uA7ksXnMdUjz3Lz1 ioOIz/KOPYp67+Y7hipR1ydxQeB3rjT+hdlP7WC4zEAzQxYjah6Y4UQ7yb5HqwAsdio9Rt/W7Mu qzsOpoxfIf2/3RDHu1t+JC2S3qlR9rMcRBlsxyw/EW0Iv/faIiDSgWbnN5GQ/pM/UeiDdzdGPNk uwnyBqHDNNwH135h6wqw9O5AQ+wlc0dQQQUAvYahjJtArYSZ216ColVYbDa1dMk8/mz9nMyDoiE hVU/3FQYCvowQ3rY+LXxhPE9MP4HqvdMxN2s36Y8ABKat5aGxdKg1RFUNicOxxxiWDrd2+aX2iV FS//uEEGigjmiRkPS5m9NwjQLTuYJDodMOe/NR/34qd0mV1VZUrYk= X-Received: by 2002:a05:600c:1f89:b0:48e:8741:fd4d with SMTP id 5b1f17b1804b1-48e8741ffa3mr41691975e9.18.1778519946896; Mon, 11 May 2026 10:19:06 -0700 (PDT) Received: from [192.168.0.112] ([5.12.125.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45491f8d4c3sm26325902f8f.34.2026.05.11.10.19.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2026 10:19:06 -0700 (PDT) Message-ID: Date: Mon, 11 May 2026 20:19:04 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org Cc: almaz.alexandrovich@paragon-software.com, m.brodschi@gmail.com From: Mihai Brodschi Subject: [PATCH v3] ntfs3: Allocate iomap inline_data using alloc_page Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This fixes a BUG reported in iomap_write_end_inline: iomap_inline_data_valid checks that the inline_data fits within a page. If the inline_data is allocated with kmemdup there's no guarantee that it's page-aligned, so the check sometimes fails. Allocate it with alloc_page to ensure it's page-aligned. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D221446 Signed-off-by: Mihai Brodschi Fixes: 099ef9a ("fs/ntfs3: implement iomap-based file operations") --- V3: fix variable declaration V2: fix mail formatting fs/ntfs3/attrib.c | 10 +++++++--- fs/ntfs3/inode.c | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index e61c5bf7e27e..ff0bf4575948 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -1004,6 +1004,7 @@ int attr_data_get_block_locked(struct ntfs_inode *ni,= CLST vcn, CLST clen, struct ATTRIB *attr, *attr_b; struct ATTR_LIST_ENTRY *le, *le_b; struct mft_inode *mi, *mi_b; + struct page *page; CLST hint, svcn, to_alloc, evcn1, next_svcn, asize, end, vcn0; CLST alloc, evcn; unsigned fr; @@ -1042,10 +1043,13 @@ int attr_data_get_block_locked(struct ntfs_inode *n= i, CLST vcn, CLST clen, *lcn =3D RESIDENT_LCN; *len =3D data_size; if (res && data_size) { - *res =3D kmemdup(resident_data(attr_b), data_size, - GFP_KERNEL); - if (!*res) + page =3D alloc_page(GFP_KERNEL); + if (!page) { err =3D -ENOMEM; + } else { + *res =3D page_address(page); + memcpy(*res, resident_data(attr_b), data_size); + } } goto out; } diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 42af1abe17f8..031f85fd53d4 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -801,7 +801,7 @@ static int ntfs_iomap_begin(struct inode *inode, loff_t= offset, loff_t length, =20 if (lcn =3D=3D RESIDENT_LCN) { if (offset >=3D clen) { - kfree(res); + __free_page(virt_to_page(res)); if (flags & IOMAP_REPORT) { /* special code for report. */ return -ENOENT; @@ -921,7 +921,7 @@ static int ntfs_iomap_end(struct inode *inode, loff_t p= os, loff_t length, =20 out: if (iomap->type =3D=3D IOMAP_INLINE) { - kfree(iomap->private); + __free_page(virt_to_page(iomap->private)); iomap->private =3D NULL; } =20 --=20 2.53.0