Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E8CE49F121 for ; Thu, 24 Sep 2026 16:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790266327; cv=none; b=RlI1X6BUdo6fRITEoZRfhDmIcIOEOSngudz870IF47NFC46UPG2c2fkQBX3Kj6XiPFpmmR/w+jH7non7FxpCVEmMmv35FBeF3GhZOAXvcRqeTrMkch8ZnRXGQCHjMFZSAgtVDPm7lxxBeR4s3sjGsInlrooKHoOxOAQ0GP/xCfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790266327; c=relaxed/simple; bh=MaPfX0kWshmFfvlbTi8qNOMRHNFkTsv8rLCuLFy5PvE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kc6A3OBj95Rx0EZ2chPEVu8431l9IjiG5zlyqcndTSs1Vg+3oaTlLt9k6YFusvN0L/mxdmI1IAcS/gudhMtQuEJMq1j4bivUhrEoIiUNeHJuE95uISZ6makGnW3FWIXdbs7d5ZY6p7ZP36JyMJp6VGtuJA8fayYAXZX1h1MQ8fw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aYYu6HNJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="aYYu6HNJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58B681F000FF; Thu, 24 Sep 2026 16:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790266326; bh=wJUhmKPFx2tQjcI8GlaS/rjtcWWaY4JpuLcZjrgT23w=; h=From:To:Cc:Subject:Date:Reply-To; b=aYYu6HNJ/jzeRr1Wc8EE6m2HvXZX529GPsnRXqy5lRG3wkz2gl3Zz3cFl4GwqfkHi Oe92FBzVz1wzW4HISUvMC5Ozaor0KCnSyVd/4Lb8Bt6dS6Oolqb+/WKEtqWNyjp9x0 ixIYLaFD7ilpSwDugGkG0gcAbm+XcfIygKOboPcs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-97416: btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk() Date: Thu, 24 Sep 2026 18:03:16 +0200 Message-ID: <2026092427-CVE-2026-97416-9a9d@gregkh> X-Mailer: git-send-email 2.55.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3221; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Xop4zCVlPMYP+G0uq1lBjHklK7lNUaGIEd7kPLrILJ4=; b=owGbwMvMwCRo6H6F97bub03G02pJDFlbPSfPiBE32jDp5d99OxrkHjXKvL6Y6nP/l30oZ4/0Y rZiPd2MjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZgIxxeGBatOh4VWztq//+n5 rXU56057rEw0U2eY7/7/oajmEeHX1ictO4WiHA+v2LX1KgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk() [BUG] Running btrfs balance can trigger a null-ptr-deref before relocating a data chunk when metadata corruption leaves a chunk in the chunk tree without a corresponding block group in the in-memory cache: KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f] RIP: 0010:btrfs_may_alloc_data_chunk+0x40/0x1c0 fs/btrfs/volumes.c:3601 Call Trace: __btrfs_balance fs/btrfs/volumes.c:4217 [inline] btrfs_balance+0x2516/0x42b0 fs/btrfs/volumes.c:4604 btrfs_ioctl_balance fs/btrfs/ioctl.c:3577 [inline] btrfs_ioctl+0x25cf/0x5b90 fs/btrfs/ioctl.c:5313 ... [CAUSE] __btrfs_balance() iterates the on-disk chunk tree and passes the chunk logical bytenr to btrfs_may_alloc_data_chunk() before relocating a data chunk. That helper then queries the in-memory block group cache: cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_type = cache->flags; /* cache may be NULL */ A corrupt image can contain a chunk item whose matching block group item is missing, so no block group is ever inserted into the cache. In that case btrfs_lookup_block_group() returns NULL. The code only guards this with ASSERT(cache), which becomes a no-op when CONFIG_BTRFS_ASSERT is disabled. The subsequent dereference of cache->flags therefore crashes the kernel. [FIX] Add a NULL check after btrfs_lookup_block_group() in btrfs_may_alloc_data_chunk() and print and error message for clarity. The Linux kernel CVE team has assigned CVE-2026-97416 to this issue. Affected and fixed versions =========================== Fixed in 6.12.111 with commit 9740dd0c17a4be8cc47a06c5ca5293471a7e286e Fixed in 6.18.53 with commit 59f75e0c8724d4adebc08c7dd3ff2358b80c21f7 Fixed in 7.2 with commit 18d32b0013efba19f7ad3e5b08d7aee813d604a6 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-97416 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: fs/btrfs/volumes.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/9740dd0c17a4be8cc47a06c5ca5293471a7e286e https://git.kernel.org/stable/c/59f75e0c8724d4adebc08c7dd3ff2358b80c21f7 https://git.kernel.org/stable/c/18d32b0013efba19f7ad3e5b08d7aee813d604a6