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 AFB001D54EE for ; Wed, 16 Apr 2025 14:19:31 +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=1744813172; cv=none; b=mzvdypbGlT0PJ0bHAQKVhPvvUIPHOn5MPeuZLRXLze2R1N8dBET8kKbBTETMivEFPLu+Vamf31edICvArlcIix71wiflLZfocYHTFSwCbfp/Qowsb6K8WRG52+wYwRz50DOMhfvPvraJCcdlAKD+BtO5Lr/NqiseceS0b4lfmWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744813172; c=relaxed/simple; bh=DePF4IcR65bnk0uDD5gMFRz3cMYvCegW7oPd3d6W2Pc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aOxjiitd51H8EWCLBue4jVolmVd7ZGwDlqRn5BUqsg6pizOLc6+ZAi/9MX/9QwYKvByu9+K7rEbePSTGExwLWPevtj+5KhKbBboKE/mmj4IWFtMOujRsOGCrfD+rrAGz1CiieZ/4xgK1oyRo0YQhenWC9dXnDj2JSvUJ7QT1w7k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NAuvqBxK; 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="NAuvqBxK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAE91C4CEE4; Wed, 16 Apr 2025 14:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744813171; bh=DePF4IcR65bnk0uDD5gMFRz3cMYvCegW7oPd3d6W2Pc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=NAuvqBxKF8O+5jKFFwY9/JJde/kWVSmeSQO7KltNlGxdkc0dIcrHjhXXwh51DMkd3 +DlNoWAhGvrEffr62Viq3CJMUMGIbHzgn8R0DR1eXI0r3w5cBvqVR+jBgTKt9a1BRe 8Jz/xoU1qh9LmTrY8SRMCDsuz3rzXwSe5HA3ovAQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-23132: f2fs: quota: fix to avoid warning in dquot_writeback_dquots() Date: Wed, 16 Apr 2025 16:13:43 +0200 Message-ID: <2025041631-CVE-2025-23132-cbf9@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=3746; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=DePF4IcR65bnk0uDD5gMFRz3cMYvCegW7oPd3d6W2Pc=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn/d10ImveGyU32xa9O785EwQAO5p8B6Sp/Q/YwT49+t 8fO1rKgI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACay+CHDHI5p+p8eOcj8UDkQ MeE/67V+DsPGeIb5kU05Og7NzuevlIYE3n0VxmIomlMCAA== 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: f2fs: quota: fix to avoid warning in dquot_writeback_dquots() F2FS-fs (dm-59): checkpoint=enable has some unwritten data. ------------[ cut here ]------------ WARNING: CPU: 6 PID: 8013 at fs/quota/dquot.c:691 dquot_writeback_dquots+0x2fc/0x308 pc : dquot_writeback_dquots+0x2fc/0x308 lr : f2fs_quota_sync+0xcc/0x1c4 Call trace: dquot_writeback_dquots+0x2fc/0x308 f2fs_quota_sync+0xcc/0x1c4 f2fs_write_checkpoint+0x3d4/0x9b0 f2fs_issue_checkpoint+0x1bc/0x2c0 f2fs_sync_fs+0x54/0x150 f2fs_do_sync_file+0x2f8/0x814 __f2fs_ioctl+0x1960/0x3244 f2fs_ioctl+0x54/0xe0 __arm64_sys_ioctl+0xa8/0xe4 invoke_syscall+0x58/0x114 checkpoint and f2fs_remount may race as below, resulting triggering warning in dquot_writeback_dquots(). atomic write remount - do_remount - down_write(&sb->s_umount); - f2fs_remount - ioctl - f2fs_do_sync_file - f2fs_sync_fs - f2fs_write_checkpoint - block_operations - locked = down_read_trylock(&sbi->sb->s_umount) : fail to lock due to the write lock was held by remount - up_write(&sb->s_umount); - f2fs_quota_sync - dquot_writeback_dquots - WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)) : trigger warning because s_umount lock was unlocked by remount If checkpoint comes from mount/umount/remount/freeze/quotactl, caller of checkpoint has already held s_umount lock, calling dquot_writeback_dquots() in the context should be safe. So let's record task to sbi->umount_lock_holder, so that checkpoint can know whether the lock has held in the context or not by checking current w/ it. In addition, in order to not misrepresent caller of checkpoint, we should not allow to trigger async checkpoint for those callers: mount/umount/remount/ freeze/quotactl. The Linux kernel CVE team has assigned CVE-2025-23132 to this issue. Affected and fixed versions =========================== Issue introduced in 4.20 with commit af033b2aa8a874fd5737fafe90d159136527b5b4 and fixed in 6.14.2 with commit d7acf0a6c87aa282c86a36dbaa2f92fda88c5884 Issue introduced in 4.20 with commit af033b2aa8a874fd5737fafe90d159136527b5b4 and fixed in 6.15-rc1 with commit eb85c2410d6f581e957cd03a644ff6ddbe592af9 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-23132 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/checkpoint.c fs/f2fs/f2fs.h fs/f2fs/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/d7acf0a6c87aa282c86a36dbaa2f92fda88c5884 https://git.kernel.org/stable/c/eb85c2410d6f581e957cd03a644ff6ddbe592af9