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=1796385060; b=RKzf+BL7i7RTMexWHbxVkeGB5ejWEYZE8L5gfhyiRZLlJdHC8zrthd5iAd5c1ALvihak B/BrEfW47Qb3cs7V7OrLbQkfB/bSWKwMppKf+V1ZLiIaoUlnKs/MaKiBiHjwQvzB3q9aN rfIRtyybj+zJqJsRRrlbVxtTLwgmXirVichzpbbrLXAaacTjkgmBQb/UUxioEaZbz1Een tun1VaFYoveENxwnguZeFMauYWSPCTPNs1s3wp1yCPmIn/CwOP2M1kXvp9x924niAA1l8 Ci8VecDwK+xmUOoX96bff308Ld4L4NwZLUPj4dpOhhFZZB5zbKVLtc0ormBrkQRz/kQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385060; 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=MFAkgqWc0RiyBS185dCo+Pjqf8rh58Vb8YzrrLDaS4I=; b=1YVzgtka8YNh29/3H9oG3NJuEF1uRUaYKg+uUL9ImIO56me/qA2KIQNQovZIvBeiw5cL OraAmAD7x0Z9kzFaJvoZRPRSOY4pVUUr2fozsSYB9xLn+V/8zo9RnUKi0lS/m3KCpGnbq qVrStQ1YhLdhhXbqKvPoS7JU2pVo8IKemXA76G5uYzUBsHDGaaFvMMkpKJlVsVTBuDFLL e+/QPLBEC2U/gzU0aUH1djV7yLB0qez8/+MNRQNzeDPMgrXBsGr9eyEHyLCQeTo5U039Y G9SQVqPzo+An7vw2iJhW785L4xT7NKuix24FtnTKet6vajYniXPduaR0TyySY6qx9ng== 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=pBePydBY; 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 1CE21606A322; Fri, 4 Dec 2026 11:51:00 +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=pBePydBY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8342C1F000C2; Fri, 4 Dec 2026 11:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385060; bh=MFAkgqWc0RiyBS185dCo+Pjqf8rh58Vb8YzrrLDaS4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pBePydBYPJGrVXlYoJzFOkDisnDu2ssSHcdYJ3TDU8axFWtAIQtQGQ3IWzSWbqJMf fRgLCPxZsF8AbiOR0KtCDfQhAaKWmLqn56nTHBCZ0ZYJokBtgcafcvBBQhVGvpMCA1 wpHq59QoHBLW/msAaMUojqpgb5l/Yt9z9T08xAAM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qu Wenruo , Daniel Vacek , Filipe Manana , David Sterba , Sasha Levin Subject: [PATCH 6.6 0401/1167] btrfs: fix off-by-one end offset check in report_setget_bounds() Date: Fri, 4 Dec 2026 18:57:08 +0900 Message-ID: <20261204100712.472106699@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Filipe Manana [ Upstream commit 08f750d9f8930e4ca053913b5ca3fd49fd9268c9 ] The addressable range with an extent buffer goes from byte 0 to byte eb->len - 1, so if a byte address matches eb->len, it's already beyond the addressable range and we should log that it's bad start address and not end address. Fixes: 234fdd2815ce ("btrfs: remove redundant check in up check_setget_bounds") Reviewed-by: Qu Wenruo Reviewed-by: Daniel Vacek Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba [ sashal: Applied the same > to >= change inline in check_setget_bounds(), since the report_setget_bounds() helper doesn't exist in this tree. ] Signed-off-by: Sasha Levin --- fs/btrfs/accessors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/accessors.c b/fs/btrfs/accessors.c index 206cf1612c1d0..7a9d8b8d648f3 100644 --- a/fs/btrfs/accessors.c +++ b/fs/btrfs/accessors.c @@ -16,7 +16,7 @@ static bool check_setget_bounds(const struct extent_buffer *eb, if (unlikely(member_offset + size > eb->len)) { btrfs_warn(eb->fs_info, "bad eb member %s: ptr 0x%lx start %llu member offset %lu size %d", - (member_offset > eb->len ? "start" : "end"), + (member_offset >= eb->len ? "start" : "end"), (unsigned long)ptr, eb->start, member_offset, size); return false; } -- 2.53.0