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 2F9341A8F68 for ; Wed, 26 Feb 2025 01:59:01 +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=1740535141; cv=none; b=Lt4CPQdljU+8+3RJZ+CBKwqUtkFo5wldHZ9QVUMTI8Tpy1Jg/q7r5h0A6hevMlaTFgHHCOLH2klJTGvKg1vqlHMeehTohM/5+KdFi75ZSC+NzaAVvsWjQkEMCSH3OIGifllrx2TEdCRlKaktWVspiJDEgnIe3EtgtPOUYJnRMz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535141; c=relaxed/simple; bh=Rze+a3WQvquO2nY7inlDzNUtBa/ZrYFc13tlpDnAbaE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Um7GLrL+CypY5OtjVcA2fonDOCzBTGBmAosfrjn3brf1nmkHbQhxECnArDm0+SaciOpwmwZsqJoz/1wMYAiFfRpvYN1tllOhVhF7qhPktWnvSDsw6Ogg7hchGpoeeewgUJyM1CSFjf5tW0Cx1E87unaZwqgi95t08NShGRo0v6M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TUyysoaX; 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="TUyysoaX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 022B2C4CEE7; Wed, 26 Feb 2025 01:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740535141; bh=Rze+a3WQvquO2nY7inlDzNUtBa/ZrYFc13tlpDnAbaE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=TUyysoaXbgtWEbLfvBsIkaonuZIGwldAjeEWvzKsbwm+UviJc2rdfJLSr5pnvFzZv LiLsDq0aeiP7CNkYrgkaDyPIj3pFuoZUMvI7T0oxqb2sTC1r0RUaV8XzhCuM3rDRI3 VHR1Pgy3WjfD4CpMpe+j5bnYza5GC+G0ihSQu4yI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49167: btrfs: do not double complete bio on errors during compressed reads Date: Wed, 26 Feb 2025 02:56:12 +0100 Message-ID: <2025022612-CVE-2022-49167-d747@gregkh> X-Mailer: git-send-email 2.48.1 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=2568; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Rze+a3WQvquO2nY7inlDzNUtBa/ZrYFc13tlpDnAbaE=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7SlwYmQzPhN49Y7C3Mb/u7NeU1Y4Nk81tTtns5m0sd F6R1ejcEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABMJmsUwvzZjz3LDXz2R3QYM oYW6/87VGO7dyLDguIfD3cWWdz+/FNz0+bu4aP+hVdu2AgA= 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 double complete bio on errors during compressed reads I hit some weird panics while fixing up the error handling from btrfs_lookup_bio_sums(). Turns out the compression path will complete the bio we use if we set up any of the compression bios and then return an error, and then btrfs_submit_data_bio() will also call bio_endio() on the bio. Fix this by making btrfs_submit_compressed_read() responsible for calling bio_endio() on the bio if there are any errors. Currently it was only doing it if we created the compression bios, otherwise it was depending on btrfs_submit_data_bio() to do the right thing. This creates the above problem, so fix up btrfs_submit_compressed_read() to always call bio_endio() in case of an error, and then simply return from btrfs_submit_data_bio() if we had to call btrfs_submit_compressed_read(). The Linux kernel CVE team has assigned CVE-2022-49167 to this issue. Affected and fixed versions =========================== Fixed in 5.16.19 with commit 4a4ceb2b990771c374d85d496a1a45255dde48e3 Fixed in 5.17.2 with commit 987b5df1d10355d377315a26e7fb6c72ded83c9f Fixed in 5.18 with commit f9f15de85d74e7eef021af059ca53a15f041cdd8 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-2022-49167 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/compression.c fs/btrfs/inode.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/4a4ceb2b990771c374d85d496a1a45255dde48e3 https://git.kernel.org/stable/c/987b5df1d10355d377315a26e7fb6c72ded83c9f https://git.kernel.org/stable/c/f9f15de85d74e7eef021af059ca53a15f041cdd8