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 E9D093BE62A for ; Fri, 1 May 2026 13:56:59 +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=1777643820; cv=none; b=tcaKRIKjNIFQrjJTWGX0X/Pkw4Q+JKux6bolvAihQ1CU4ckeGmJv5w6oLfzGgDwpeYOyWiuYa0jv5bdb9zQjz+GLoqz7XA9eufrRhq+r4jgXNYrNUmZmi3c2KX5g0frkOnGN6VHR9EhcVV1PISdM2ncopChQJawKMyjH3O6WrSU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777643820; c=relaxed/simple; bh=PrbWaflPpM76t1XHI7yY9BvyOmZllhh42jnmnGGU9EM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WwnE1er2EsuumLKiQ/Gx4HZWPBK53wSZAeoA6Yl3blURb0oc1BcP9r0aoZAKeprRHfVPXvJupeI0kFIVyx3jQ1zoFkQAzabTZF6CdQEzdFo/62CoH9ZPTMgHgmHlFzmGG5JZY4ZU+wmDcuktksqJ3jyqZQwb0k3L9pWMVlKTMlQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gF+tglp4; 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="gF+tglp4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4272AC2BCB4; Fri, 1 May 2026 13:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777643819; bh=PrbWaflPpM76t1XHI7yY9BvyOmZllhh42jnmnGGU9EM=; h=From:To:Cc:Subject:Date:Reply-To:From; b=gF+tglp4aL1rLJc4tbEKE0bwMax5HqWt0jV3xs+NecOR7eCuREpfeW8FYws6uQq6q A6cO5YGp8mcp3IDS5SLFerzRUKnQ+4axepg/nrci5MKEsm9P+J+pTGb2uw6nIppbFQ E+89RTirmxwJ0qZgmPkNe6MOTADEXu1QSkp1N7XI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-31715: f2fs: fix UAF caused by decrementing sbi->nr_pages[] in f2fs_write_end_io() Date: Fri, 1 May 2026 15:56:37 +0200 Message-ID: <2026050123-CVE-2026-31715-891c@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=3383; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=QAtd35u9aK7jwvumipxcRaLORgxv0C2Ylx/iXn1dzvQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDJlfNnIIheRN7JD/qT2t9sDxvULm8eGCZtdtdRrDLqRN5 78nzvazI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACaSf4BhwbUiYb9LjELna1if 8AvpKU8TOm7Fw7Bg/dVCiSmhL1a2T1wwqeXqvDkcXI+iAA== 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: f2fs: fix UAF caused by decrementing sbi->nr_pages[] in f2fs_write_end_io() The xfstests case "generic/107" and syzbot have both reported a NULL pointer dereference. The concurrent scenario that triggers the panic is as follows: F2FS_WB_CP_DATA write callback umount - f2fs_write_checkpoint - f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA) - blk_mq_end_request - bio_endio - f2fs_write_end_io : dec_page_count(sbi, F2FS_WB_CP_DATA) : wake_up(&sbi->cp_wait) - kill_f2fs_super - kill_block_super - f2fs_put_super : iput(sbi->node_inode) : sbi->node_inode = NULL : f2fs_in_warm_node_list - is_node_folio // sbi->node_inode is NULL and panic The root cause is that f2fs_put_super() calls iput(sbi->node_inode) and sets sbi->node_inode to NULL after sbi->nr_pages[F2FS_WB_CP_DATA] is decremented to zero. As a result, f2fs_in_warm_node_list() may dereference a NULL node_inode when checking whether a folio belongs to the node inode, leading to a panic. This patch fixes the issue by calling f2fs_in_warm_node_list() before decrementing sbi->nr_pages[F2FS_WB_CP_DATA], thus preventing the use-after-free condition. The Linux kernel CVE team has assigned CVE-2026-31715 to this issue. Affected and fixed versions =========================== Issue introduced in 4.19 with commit 50fa53eccf9f911a5b435248a2b0bd484fd82e5e and fixed in 6.18.25 with commit 963d2e24d9d92a31e6773b0f642214f10013ebf7 Issue introduced in 4.19 with commit 50fa53eccf9f911a5b435248a2b0bd484fd82e5e and fixed in 7.0.2 with commit 188bb65f247a7a7c62f287c9a263aee3cad96fa5 Issue introduced in 4.19 with commit 50fa53eccf9f911a5b435248a2b0bd484fd82e5e and fixed in 7.1-rc1 with commit 2d9c4a4ed4eef1f82c5b16b037aee8bad819fd53 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-31715 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/f2fs/data.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/963d2e24d9d92a31e6773b0f642214f10013ebf7 https://git.kernel.org/stable/c/188bb65f247a7a7c62f287c9a263aee3cad96fa5 https://git.kernel.org/stable/c/2d9c4a4ed4eef1f82c5b16b037aee8bad819fd53