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 A5C9116F265 for ; Wed, 16 Apr 2025 14:18:05 +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=1744813085; cv=none; b=mT93PJ716Hai7TH1+upy4HuLakzhlPPEH4QhnCP6Tzkc5GTILnQl+ZXj/VKikATjTNuuHif4szw9goVhQlirC8sSs25l6ho976pQyxA/93h5FlmAu8zzGEmX0SneYqnMawdGRrwaAJOXH0OoJaHqkVDDhu6cp1ZJVyDJefC3c/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744813085; c=relaxed/simple; bh=sbth0ojFnFM9j5Ifhb5y+ig0qJ4n06En3Ov2G6q6i1I=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DvU7DceOLk9FexKD6RDunxaM3z+xznPSf+N1kbTdYxZJbtTDmjTTSeJNkmQdugTeoK5XqIQWm13QC1+M59FMyRswRhjCZSDlIu206wUTR+A/6ja+YljQIBBEfUNrORlodDbnVuykRLQ48JGkJkb5rVeArXgj7OKgFjm9MgBXh38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lVWSG6EQ; 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="lVWSG6EQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16293C4CEE2; Wed, 16 Apr 2025 14:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744813085; bh=sbth0ojFnFM9j5Ifhb5y+ig0qJ4n06En3Ov2G6q6i1I=; h=From:To:Cc:Subject:Date:Reply-to:From; b=lVWSG6EQmFC3yMvvL2sy6cJNaA+4eOQdjSgtg0aL31lTy9L3fmxSV7rnglEGXtS2S qMk5f2u/kAeL6Zw3Tm1j8GyZe07w0/nj39IJisduG4nolO5QGkbHTnAdBfIU+FjFHd kKlzGXWIAfg21QMiSK7Ue6xd4f4WzVl8tonTXqVM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-22113: ext4: avoid journaling sb update on error if journal is destroying Date: Wed, 16 Apr 2025 16:13:24 +0200 Message-ID: <2025041625-CVE-2025-22113-34cd@gregkh> X-Mailer: git-send-email 2.49.0 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=4068; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=sbth0ojFnFM9j5Ifhb5y+ig0qJ4n06En3Ov2G6q6i1I=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn/d528V7bufYzWvaM1zLv+SK2Z2zXPc9t7hc8bjb5PT HKatHbmyo5YFgZBJgZZMUWWL9t4ju6vOKToZWh7GmYOKxPIEAYuTgGYiGo1w/x4vpaZ9g43X03g vJl/7obyzqNTWh0YFkxSOfg18v3L1uW3U162tpq1h/+8IwcA 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: ext4: avoid journaling sb update on error if journal is destroying Presently we always BUG_ON if trying to start a transaction on a journal marked with JBD2_UNMOUNT, since this should never happen. However, while ltp running stress tests, it was observed that in case of some error handling paths, it is possible for update_super_work to start a transaction after the journal is destroyed eg: (umount) ext4_kill_sb kill_block_super generic_shutdown_super sync_filesystem /* commits all txns */ evict_inodes /* might start a new txn */ ext4_put_super flush_work(&sbi->s_sb_upd_work) /* flush the workqueue */ jbd2_journal_destroy journal_kill_thread journal->j_flags |= JBD2_UNMOUNT; jbd2_journal_commit_transaction jbd2_journal_get_descriptor_buffer jbd2_journal_bmap ext4_journal_bmap ext4_map_blocks ... ext4_inode_error ext4_handle_error schedule_work(&sbi->s_sb_upd_work) /* work queue kicks in */ update_super_work jbd2_journal_start start_this_handle BUG_ON(journal->j_flags & JBD2_UNMOUNT) Hence, introduce a new mount flag to indicate journal is destroying and only do a journaled (and deferred) update of sb if this flag is not set. Otherwise, just fallback to an un-journaled commit. Further, in the journal destroy path, we have the following sequence: 1. Set mount flag indicating journal is destroying 2. force a commit and wait for it 3. flush pending sb updates This sequence is important as it ensures that, after this point, there is no sb update that might be journaled so it is safe to update the sb outside the journal. (To avoid race discussed in 2d01ddc86606) Also, we don't need a similar check in ext4_grp_locked_error since it is only called from mballoc and AFAICT it would be always valid to schedule work here. The Linux kernel CVE team has assigned CVE-2025-22113 to this issue. Affected and fixed versions =========================== Issue introduced in 5.11 with commit 2d01ddc86606564fb08c56e3bc93a0693895f710 and fixed in 6.14.2 with commit db05767b5bc307143d99fe2afd8c43af58d2ebef Issue introduced in 5.11 with commit 2d01ddc86606564fb08c56e3bc93a0693895f710 and fixed in 6.15-rc1 with commit ce2f26e73783b4a7c46a86e3af5b5c8de0971790 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-2025-22113 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/ext4/ext4.h fs/ext4/ext4_jbd2.h fs/ext4/super.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/db05767b5bc307143d99fe2afd8c43af58d2ebef https://git.kernel.org/stable/c/ce2f26e73783b4a7c46a86e3af5b5c8de0971790