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 33F014FE2C2 for ; Thu, 17 Sep 2026 16:22:49 +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=1789662171; cv=none; b=NdgOMms1crBQEquBOdXSVzo0JtXIdu7a3UkN5GlBxjtin5VdntaP92IqIWe3LA7KNnVt+N7l872W8K8QttHwMrYfTit74mOtRivn54F6LbqNjaRGuFWfQUBqVXgNNuI5ZmY7hOel08v6EmJ7vY3bcdebhYz55pz994e1hSrWUXs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789662171; c=relaxed/simple; bh=51nW6KmzNXsoBLBtucqbhLnoGMqhbOAHIaE8m7VSi7U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ttnSBhDvMG6zZktxbPU5+0648FVMaeOOKODQj9xOVdSQzU3ViC5zayNU7N0K68SnxJgg9AZckrdb1R5dptZhAbVKDIw/808SYEJn/Szv6sH9WsB3nx0TJ3AMaBRVuCGNEHwtah8I0jJACN+ATbR9xS2Pzw7pSrk0I5dLCtA4ah4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bcTujm/Y; 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="bcTujm/Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 892E81F000FF; Thu, 17 Sep 2026 16:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789662169; bh=86LdtlMS6IskzQB3MAgQWER8q72WicCWegwT5aVELbM=; h=From:To:Cc:Subject:Date:Reply-To; b=bcTujm/YjFvHGiFINMZauHVkn6mhWKTadn8ahMEwyIsRpTGFfFybesJs4L8C6nH6/ i1g+fG1JtSIwmVJ5VGa6eWhVm6sqhaTsi4A0IxpEWHOOblwIZjNqqUh0snjy1awhu+ /AJsYwG3uqqKwNd8MM6HaeUTyjV2ENOm37M9NduM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-90264: btrfs: always wait for ordered extents to avoid OE races Date: Thu, 17 Sep 2026 17:11:34 +0100 Message-ID: <2026091747-CVE-2026-90264-5401@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=5964; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=4XlVSGy211VPhP3pO9I2l/XXaPB0PIyn0jCWDS4fuw0=; b=owGbwMvMwCRo6H6F97bub03G02pJDFlrBPrr1Qp9+Wv7WjvExRde2yHCdPT8FLcJU+UuyW732 +EaeiGxI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACZi48AwV3BhgrrgTnVBAzbp W59EQheqmUg+YFiwP1nshXhgZdqNNQd3TetfecwlYvd2AA== 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: always wait for ordered extents to avoid OE races [BUG] Syzbot reported a bug that there can be conflicting OEs for the same range: BTRFS critical (device loop4): panic in insert_ordered_extent:264: overlapping ordered extents, existing oe file_offset 16384 num_bytes 430080 flags 0x1089, new oe file_offset 16384 num_bytes 430080 flags 0x80 (errno=-17 Object alrea[ 179.162726][ T6897] BTRFS critical (device loop4): panic in insert_ordered_extent:264: overlapping ordered extents, existing oe file_offset 16384 num_bytes 430080 flags 0x1089, new oe file_offset 16384 num_bytes 430080 flags 0x80 (errno=-17 Object already exists) ------------[ cut here ]------------ kernel BUG at fs/btrfs/ordered-data.c:264! Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026 RIP: 0010:btrfs_alloc_ordered_extent+0x943/0xad0 Call Trace: cow_file_range+0x744/0x12a0 fallback_to_cow+0x5ea/0xa00 run_delalloc_nocow+0x110c/0x17a0 btrfs_run_delalloc_range+0xbe4/0x1c20 writepage_delalloc+0x104d/0x1ba0 btrfs_writepages+0x1667/0x28b0 do_writepages+0x338/0x560 filemap_fdatawrite_range+0x1f2/0x300 btrfs_fdatawrite_range+0x54/0xf0 btrfs_direct_write+0x6a0/0xc30 btrfs_do_write_iter+0x329/0x790 do_iter_readv_writev+0x624/0x8d0 vfs_writev+0x34c/0x990 __se_sys_pwritev2+0x17a/0x2a0 do_syscall_64+0x174/0x580 entry_SYSCALL_64_after_hwframe+0x77/0x7f ---[ end trace 0000000000000000 ]--- [CAUSE] Since commit ff66fe666233 ("btrfs: fix incorrect buffered IO fallback for append direct writes"), if the direct IO finished short, we will revert the isize back to the original one, so that append writes can be respected during the buffered fallback. Normally we rely on lock_and_cleanup_extent_if_need() function during buffered writeback to wait for any existing ordered extents. But that ordered extent waiting only happens if the start_pos is inside the isize. Since we have reverted the isize during failed direct IO, we will not wait for any ordered extents. This means we can have a race where the direct IO OE is still in the tree, finished but not yet removed, then we're inserting the OE for the buffered write, causing the above crash. [FIX] Make the OE wait to be unconditional, to handle the reverted isize situation. And since lock_and_cleanup_extent_if_need() now either lock the extents or return -EAGAIN, also remove the branches that handles no-extent-locked cases, and rename it to remove the "_if_need" suffix. The following micro benchmark shows the runtime difference for btrfs_buffered_write(), doing `xfs_io -f -c "pwrite 0 1m"` workload, all values are the average runtime in nano seconds. function runtime | before | after -----------------------------------+-------------+--------------- lock_and_cleanup_extent_if_need() | 58.2 | 183.0 btrfs_buffered_write() | 2115.6 | 2973.3 The overall runtime of btrfs_buffered_write() is still pretty tiny (still less than 3 micro seconds), I'd say the extra cost is still acceptable. An alternative to fix this problem is to wait ordered extents during iomap_end() where the isize revert is done. But that solution will break nowait requirement, as if a nowait direct IO finished short, we have to wait for the OEs unconditionally or the next append buffered IO can still hit the same problem. So here we have to move the wait cost to buffered write, but at least the code is slightly more streamline. The Linux kernel CVE team has assigned CVE-2026-90264 to this issue. Affected and fixed versions =========================== Issue introduced in 6.18.40 with commit c3a3d3986719026c85950bfa6f41a251fc46e16f and fixed in 6.18.52 with commit 58ce50b1802a446d3b26df1b9c58be1ab8913d0e Issue introduced in 7.2 with commit ff66fe6662330226b3f486014c375538d91c44aa and fixed in 7.2.6 with commit aaac9b352f7f53f5d2f7e58e612d67d2a2bf7094 Issue introduced in 7.2 with commit ff66fe6662330226b3f486014c375538d91c44aa and fixed in 7.3-rc1 with commit ec78575dde998c21be7e0cb2503b5620f34b6255 Issue introduced in 5.15.212 with commit 4b5875cbb85dbf4d11385eb0a7a589c086d76d42 Issue introduced in 6.1.178 with commit 10b1abc1d0c8ae25c2b9ac465515717c68ffff05 Issue introduced in 6.6.145 with commit 097b159d43407b4ea0e5d14ae58a3bbfa5865a24 Issue introduced in 6.12.97 with commit ccd5c23122b01de646c80485e2fadac82d1aab62 Issue introduced in 7.1.4 with commit b8df7f486a4617d3096b8fa27148cfa54b1d6a8d 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-90264 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/file.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/58ce50b1802a446d3b26df1b9c58be1ab8913d0e https://git.kernel.org/stable/c/aaac9b352f7f53f5d2f7e58e612d67d2a2bf7094 https://git.kernel.org/stable/c/ec78575dde998c21be7e0cb2503b5620f34b6255