From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387719; b=bzYJukxNGP9vZ7abDPDPYxlaHXCtz2pxn1UWITFguW/thyRbwKzl4Q1beP65EPw2IvKn tTGnhVZZ+efhBFIc2c/e1kqK3Wtd1d+tK0+CMVip7RIe8b9VmCaHn9e4LPyEsBeVYvpoH udHsZYNpndKLa0ZqkuFcAttRPea8rPEnvzjAZATvWT/CGKM4fN/BS0471AqpL8Sq9NuFa X0oJEo1ULMX3z4I2b3j/IuThNd9Mxch4FlAsgAobUp/2tr3FaUEyUgCCqG0PAbOyzfy+Y IOYvn3mg8sFRdwcyOF3E53bNspwXmwEDaTOpnCRE0LLOhldZIQs7s9zbsjNC2OxuVrw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387719; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=OvL4myeoSU1PSEGnEtY7kD8G6nAvErVC/eAa609w8j4=; b=WXbenlgpnEm+GY7blm0CcjMM9Hczm8bHZdLJWLN6/gjUN7/Hae/gjh9NXlouL1zv0PgL VXButfiVDK1FMxY1HIerCRO2KCA8CO7ZgwYjOGuHhvXvacjbA830XE5wCzIzVT0YE9EQ1 SaQ9pT3drni3/AW9VLRPoOmUnK2r0VMsiX+r/cqkoqOkQ7LJ0Y3IvkInrIsWGvFqIh2sd LCJ3Ay0SzcosxGXopxGT1ilwNaLeeMwUfESieaxqmHlEEvtGmaBNeBnxmpL6nzcx0+mDl kYFjaWF+BWmFET0H667kgDXY7a3+zZHp3H48mSf+8wmSzp20HkAMqMKCfo030OwWxBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fWFwL8ij; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E24E606A322; Fri, 4 Dec 2026 12:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fWFwL8ij Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A9701F000C2; Fri, 4 Dec 2026 12:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387719; bh=OvL4myeoSU1PSEGnEtY7kD8G6nAvErVC/eAa609w8j4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fWFwL8ijKO3Gh6YUyw5UWCnSi2uUi6Dp7LXN2VocD6gOdykDhPwRRPJF7HE3EAGBv euRrrfvmjyX+D86UANb57Gj6MeHCIOJeBi1AzkAJow2DQtSCEmmS35+xnq7WsJMRoQ MnedUqecosQjpCT6jbIQVEap/5VB/NSgfpaM9GOc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Morgun , Konstantin Komarov , Sasha Levin Subject: [PATCH 6.1 0360/1059] fs/ntfs3: check return values in indx_delete_entry() Date: Fri, 4 Dec 2026 18:58:11 +0900 Message-ID: <20261204100653.594050483@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Morgun [ Upstream commit 131f7d7abf0f10edc6ea6b032f8a3908bdb13ce8 ] When the index tree collapses down to an empty root, indx_delete_entry() calls attr_set_size() and ni_remove_attr() for both ATTR_ALLOC and ATTR_BITMAP, but their return values are overwritten by the following call without being checked. In most other call sites of these functions the return value is checked, so add the same checks here in case an error at this point is meaningful. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Dmitry Morgun Signed-off-by: Konstantin Komarov [ sashal: Added four error checks after the attr_set_size/ni_remove_attr calls in the index collapse path, passing an extra NULL argument to attr_set_size() for the older signature and omitting the missing i_size_write context. ] Signed-off-by: Sasha Levin --- fs/ntfs3/index.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 05e4c2fee712d..18620b37e69e4 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -2684,15 +2684,25 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni, err = attr_set_size(ni, ATTR_ALLOC, in->name, in->name_len, &indx->alloc_run, 0, NULL, false, NULL); + if (err) + goto out; + err = ni_remove_attr(ni, ATTR_ALLOC, in->name, in->name_len, false, NULL); run_close(&indx->alloc_run); + if (err) + goto out; err = attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len, &indx->bitmap_run, 0, NULL, false, NULL); + if (err) + goto out; + err = ni_remove_attr(ni, ATTR_BITMAP, in->name, in->name_len, false, NULL); run_close(&indx->bitmap_run); + if (err) + goto out; root = indx_get_root(indx, ni, &attr, &mi); if (!root) { -- 2.53.0