Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8C6FD7F9 for ; Wed, 4 Sep 2024 18:36:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725475004; cv=none; b=fczXxN1TpChbEJDco3BMBq2xOBolCTJ6PLdCdjwAx4G3BMhHMaM/1hx3eDBx/IOypDa53ciT5xclIxYh55MnE7ogbbekt3Jiwrbip3iyJcFEqHz3ptKowG0juH9ZQvAJX/rG4C2UeewE/diTSQtTvAqF+IEqBEg6JVrDU7boB90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725475004; c=relaxed/simple; bh=V2I6OZEaFsxKeJiCwS5BMOc1XO/Ht+AfGZcVAWuCKPw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=R4R/wDqqtwFeloH+1yfmrPC4/PVJ4wta5g8ppg/ki6aM4rkn9s/hUirtXfA0Vlet2HSgxBqsQbcabXHj/3HxrJtiBH8ZJYlw+U+6g7N1LfgoP3Eds1+EqlHQGhn8aJ+vwJrIaxkiBttDFnhcH4GlAOliGU2GC06Vigcbl3B71jc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KCyTDiuI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KCyTDiuI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9356C4CEC2; Wed, 4 Sep 2024 18:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725475004; bh=V2I6OZEaFsxKeJiCwS5BMOc1XO/Ht+AfGZcVAWuCKPw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=KCyTDiuIqFCN9gpGnX2toM4K2dDKuGMQ9LuPuCqyyX3QS4dcX5xJTzpEjVtH2BKpV 37FVBX3xm199vXoaybi9Kfjx+gCZXFmcyKEg9NLeQ0GOXTQk9O7rFeNUm7l2OPGbqb vnHncmQ6g0rgU9d1ys4M0O9q0KFw4+2pvWXxu9q0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-44963: btrfs: do not BUG_ON() when freeing tree block after error Date: Wed, 4 Sep 2024 20:36:23 +0200 Message-ID: <2024090414-CVE-2024-44963-2e6d@gregkh> X-Mailer: git-send-email 2.46.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2371; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=V2I6OZEaFsxKeJiCwS5BMOc1XO/Ht+AfGZcVAWuCKPw=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk3VszTmHZJnfugy8tzYdvUF6fb+EU9Vjc+8Uxme6D4I eOLR2fmdsSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEDFUY5uevsLrgHpQ/4X7Y heWNhz+d0dzzMZ9hwQW9v7raM5YWmt2a+zD6GoNz2M6iTAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: btrfs: do not BUG_ON() when freeing tree block after error When freeing a tree block, at btrfs_free_tree_block(), if we fail to create a delayed reference we don't deal with the error and just do a BUG_ON(). The error most likely to happen is -ENOMEM, and we have a comment mentioning that only -ENOMEM can happen, but that is not true, because in case qgroups are enabled any error returned from btrfs_qgroup_trace_extent_post() (can be -EUCLEAN or anything returned from btrfs_search_slot() for example) can be propagated back to btrfs_free_tree_block(). So stop doing a BUG_ON() and return the error to the callers and make them abort the transaction to prevent leaking space. Syzbot was triggering this, likely due to memory allocation failure injection. The Linux kernel CVE team has assigned CVE-2024-44963 to this issue. Affected and fixed versions =========================== Fixed in 6.10.5 with commit 98251cd60b4d Fixed in 6.11-rc1 with commit bb3868033a4c 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-2024-44963 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/ctree.c fs/btrfs/extent-tree.c fs/btrfs/extent-tree.h fs/btrfs/free-space-tree.c fs/btrfs/ioctl.c fs/btrfs/qgroup.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/98251cd60b4d702a8a81de442ab621e83a3fb24f https://git.kernel.org/stable/c/bb3868033a4cccff7be57e9145f2117cbdc91c11