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 0D82E3CF034 for ; Wed, 6 May 2026 07:43:02 +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=1778053382; cv=none; b=GIbzf8u7eSP2XQkvt1zUSrahQUBebuG7fHQVk5/mISGLX1ggjrSbQPOcS+a8mjejevNJPEZtAUFudCO+sxJhmcD7sDxvsQzlJGVCENGqupxrmKMlGArbjAww4O+DNQEL0updfcJQavKCaIFCZZownngpCdfkUb0Y3B1ZiBXUrHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778053382; c=relaxed/simple; bh=wBfEzq4XuQGOU/DQ3uG4+rAKDkIoLwT9lYEi8F5fV5g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MkbbLaW086rVJLQjuRN+LVah4I3LA9o+9gMKkghys22ToVEZ9U67Hy6nMsj5Z8R5i3Rn3uIGOfcumdwwPZnStrnPsh8Sx+NrWgRZzdr1iO8CRkpb7/24ENdkhaHPCAllTwjGQoegcFKehRUlobO5RsOT6xR+rShlEvYXKvMEUoU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ab+Ot5ng; 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="Ab+Ot5ng" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92FB9C2BCB8; Wed, 6 May 2026 07:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778053381; bh=wBfEzq4XuQGOU/DQ3uG4+rAKDkIoLwT9lYEi8F5fV5g=; h=From:To:Cc:Subject:Date:Reply-To:From; b=Ab+Ot5ngDE3Wjk2CcNUTKhlGzLlMNkbspbekc/V6NcfM/hTXv34iyIDl7MiVPcp3W zFSajve8fFzhjytBGW068ZYdVfgMCE/ABTd02IS622fq8WkSORNnY/lXvxuvSLv4ud +RLPuZ+6uiNo8wOrL+rn4zargNYe2bgIuSnAwxBo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-43118: btrfs: fix zero size inode with non-zero size after log replay Date: Wed, 6 May 2026 09:41:52 +0200 Message-ID: <2026050627-CVE-2026-43118-972c@gregkh> X-Mailer: git-send-email 2.54.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=3807; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Xpix9xGEhyCyqD5KiFV/r6GPIwUAh0B2pQ+D9ABMV18=; b=owGbwMvMwCRo6H6F97bub03G02pJDJm/Piz3/fMzrT93WdBhu/9v+PZJHvgiPDu/bMr5eUsiF n+vjPXb3RHLwiDIxCArpsjyZRvP0f0VhxS9DG1Pw8xhZQIZwsDFKQAT+RXKME+BZdIHzgtGgbWX 2TPilE8wGTx9dpBhrtzve7+u5TK9694nlzyTa+ZCS07mXwA= 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: fix zero size inode with non-zero size after log replay When logging that an inode exists, as part of logging a new name or logging new dir entries for a directory, we always set the generation of the logged inode item to 0. This is to signal during log replay (in overwrite_item()), that we should not set the i_size since we only logged that an inode exists, so the i_size of the inode in the subvolume tree must be preserved (as when we log new names or that an inode exists, we don't log extents). This works fine except when we have already logged an inode in full mode or it's the first time we are logging an inode created in a past transaction, that inode has a new i_size of 0 and then we log a new name for the inode (due to a new hardlink or a rename), in which case we log an i_size of 0 for the inode and a generation of 0, which causes the log replay code to not update the inode's i_size to 0 (in overwrite_item()). An example scenario: mkdir /mnt/dir xfs_io -f -c "pwrite 0 64K" /mnt/dir/foo sync xfs_io -c "truncate 0" -c "fsync" /mnt/dir/foo ln /mnt/dir/foo /mnt/dir/bar xfs_io -c "fsync" /mnt/dir After log replay the file remains with a size of 64K. This is because when we first log the inode, when we fsync file foo, we log its current i_size of 0, and then when we create a hard link we log again the inode in exists mode (LOG_INODE_EXISTS) but we set a generation of 0 for the inode item we add to the log tree, so during log replay overwrite_item() sees that the generation is 0 and i_size is 0 so we skip updating the inode's i_size from 64K to 0. Fix this by making sure at fill_inode_item() we always log the real generation of the inode if it was logged in the current transaction with the i_size we logged before. Also if an inode created in a previous transaction is logged in exists mode only, make sure we log the i_size stored in the inode item located from the commit root, so that if we log multiple times that the inode exists we get the correct i_size. A test case for fstests will follow soon. The Linux kernel CVE team has assigned CVE-2026-43118 to this issue. Affected and fixed versions =========================== Fixed in 6.18.24 with commit fddb157536e67a055597f00a8b4922d5f5ed0826 Fixed in 6.19.14 with commit 03e966b63df5b06790310c1faaf3e0cb43adea8b Fixed in 7.0 with commit 5254d4181add9dfaa5e3519edd71cc8f752b2f85 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-43118 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/tree-log.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/fddb157536e67a055597f00a8b4922d5f5ed0826 https://git.kernel.org/stable/c/03e966b63df5b06790310c1faaf3e0cb43adea8b https://git.kernel.org/stable/c/5254d4181add9dfaa5e3519edd71cc8f752b2f85