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 37C2319149C for ; Tue, 30 Jul 2024 07:51:56 +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=1722325916; cv=none; b=axRsLpJWITST/R3vmstz3nNdQMeydv569R5u5P+2u0GGEqEH7ttde1K3FIHA0bW5VfPIU5f5JnlGKZ+aaT1T5vWW1CpRwoKZIvch8yx0lErRNJY77BdjP6ph68JC3pui2qnddHDIKO+uGXEsiibeq5Kgm5CEI7zg4H+pMQ4pXR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722325916; c=relaxed/simple; bh=WrsRMqT/1ruhvGOJjofpEB13NJZxWNbwAeh4V/6KQ30=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GuH9mtR9A4GhbO3uxpolsUKOi1uzktb7BbTORaGsJND1HhMGHhHCr1exTzY9fZ9bSEFMGh9H6HzA2q7xHbs1szFbhWouqSeh9OaRH2T6mrpWWTw53Az2haJfSDspDa5viJfMIrFv64s5rxZSUXhsMm+P7q1DTDh2gYQS6dxat0M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SEf+BkLW; 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="SEf+BkLW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C79BC32782; Tue, 30 Jul 2024 07:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722325916; bh=WrsRMqT/1ruhvGOJjofpEB13NJZxWNbwAeh4V/6KQ30=; h=From:To:Cc:Subject:Date:Reply-to:From; b=SEf+BkLW/QU2iHDMwN799O1piQdVKf1CWKbopeTKKcl7Ms8aWmxIbi5HSFunT0GgJ L9I9tJRNoXYzhcEZWx46QtZT3bJA/HuORS6TsyygkJ0nTZyHEjeyZ8GI7NS490Zz93 5f5ra4L6p0FB0BtGwND6Bd20OOh4f+gadB3FxPHI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-42231: btrfs: zoned: fix calc_available_free_space() for zoned mode Date: Tue, 30 Jul 2024 09:48:29 +0200 Message-ID: <2024073039-CVE-2024-42231-db41@gregkh> X-Mailer: git-send-email 2.45.2 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=2486; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=WrsRMqT/1ruhvGOJjofpEB13NJZxWNbwAeh4V/6KQ30=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkrZs2OP3amMHpOyN7Gm2KyZmwbcjN8DvWukE3NqdgQ9 ypcKd2kI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACaisJdhDu/yuVsX/1//7pjH qvsZqoUJZf+5gxnmVx3kMLV1ev6es2aO3IPiyOVnjnfvBQA= 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: zoned: fix calc_available_free_space() for zoned mode calc_available_free_space() returns the total size of metadata (or system) block groups, which can be allocated from unallocated disk space. The logic is wrong on zoned mode in two places. First, the calculation of data_chunk_size is wrong. We always allocate one zone as one chunk, and no partial allocation of a zone. So, we should use zone_size (= data_sinfo->chunk_size) as it is. Second, the result "avail" may not be zone aligned. Since we always allocate one zone as one chunk on zoned mode, returning non-zone size aligned bytes will result in less pressure on the async metadata reclaim process. This is serious for the nearly full state with a large zone size device. Allowing over-commit too much will result in less async reclaim work and end up in ENOSPC. We can align down to the zone size to avoid that. The Linux kernel CVE team has assigned CVE-2024-42231 to this issue. Affected and fixed versions =========================== Issue introduced in 6.7 with commit cb6cbab79055 and fixed in 6.9.9 with commit 8548903b1999 Issue introduced in 6.7 with commit cb6cbab79055 and fixed in 6.10 with commit 64d2c847ba38 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-42231 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/space-info.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/8548903b1999bba02a2b894ad750ab8eb1f40307 https://git.kernel.org/stable/c/64d2c847ba380e07b9072d65a50aa6469d2aa43f