From mboxrd@z Thu Jan 1 00:00:00 1970 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 13417304BC5 for ; Wed, 12 Nov 2025 10:24:57 +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=1762943098; cv=none; b=Gk8LGyNsXDn8Ryzdk0N/e0OrRBdbZeihQfmJX1blqmSzzFuZRyCM+UnVy4Onmfme8D+XzkBJrN+4pCUZmCHVMrKVXcvpeC5kRQYFC6VCA9VZ/Yl1tdA2NtcsPohOI8vHE3Q0FlPw3X/DUlNc1SKOr2PNokpVXH3laN4gV/nr5bY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762943098; c=relaxed/simple; bh=vz6O2w/V/9jubhhgt1VylHXmfwtvgYsELojBuArh/6Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WAmJNKW1dj1qLw2+vEk3IcOqlA4l1mdZPhpIIGIKVoZmXclZLVS7v726xwjnDD/oES737wvRFEwkVjyGZV9hQCvNjW3N6giFdyfyVpmTxijn4BbvQwdoeAX4cVCYivxuywB/tpoEe3iHcbDoreYr/fYIGVFGlEH98jWkbDcDOnU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oRmScODw; 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="oRmScODw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC0DC4CEF7; Wed, 12 Nov 2025 10:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762943097; bh=vz6O2w/V/9jubhhgt1VylHXmfwtvgYsELojBuArh/6Q=; h=From:To:Cc:Subject:Date:Reply-to:From; b=oRmScODwRVITd6Y/OsUFOImXCKDzyNIhOMqXTNbaR75szB4EaADdG3NiEORm2gaBy I2N58Ii5j5xsmnyVqtU/4a8aF2KYFj+twLahjit4Z/5+yUxL/+5ehV8LuojoRv4VIi wvaGoaaE1kSGU2JAdyGGn37QlzbKw0Y1hXSoB2C8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-40138: f2fs: fix to avoid NULL pointer dereference in f2fs_check_quota_consistency() Date: Wed, 12 Nov 2025 19:24:14 +0900 Message-ID: <2025111255-CVE-2025-40138-e96d@gregkh> X-Mailer: git-send-email 2.51.2 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=3429; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=xVFc2gp+0TEkNSEQBw9yY2Z+L4/livanE/qmHYEN0mI=; b=owGbwMvMwCRo6H6F97bub03G02pJDJkiCdZuJc8+cDDyLvt/mPnSE9PJPRHXFzMms+SLHhSJk OJo1g/riGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIlMkGaYZ+j/THTFheV3l0Rr v385N7nXW2LNVIY5XA9C3vvvXXzn+BK5qVJ/33GsnN/yEAA= 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 to avoid NULL pointer dereference in f2fs_check_quota_consistency() syzbot reported a f2fs bug as below: Oops: gen[ 107.736417][ T5848] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 1 UID: 0 PID: 5848 Comm: syz-executor263 Tainted: G W 6.17.0-rc1-syzkaller-00014-g0e39a731820a #0 PREEMPT_{RT,(full)} RIP: 0010:strcmp+0x3c/0xc0 lib/string.c:284 Call Trace: f2fs_check_quota_consistency fs/f2fs/super.c:1188 [inline] f2fs_check_opt_consistency+0x1378/0x2c10 fs/f2fs/super.c:1436 __f2fs_remount fs/f2fs/super.c:2653 [inline] f2fs_reconfigure+0x482/0x1770 fs/f2fs/super.c:5297 reconfigure_super+0x224/0x890 fs/super.c:1077 do_remount fs/namespace.c:3314 [inline] path_mount+0xd18/0xfe0 fs/namespace.c:4112 do_mount fs/namespace.c:4133 [inline] __do_sys_mount fs/namespace.c:4344 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4321 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The direct reason is f2fs_check_quota_consistency() may suffer null-ptr-deref issue in strcmp(). The bug can be reproduced w/ below scripts: mkfs.f2fs -f /dev/vdb mount -t f2fs -o usrquota /dev/vdb /mnt/f2fs quotacheck -uc /mnt/f2fs/ umount /mnt/f2fs mount -t f2fs -o usrjquota=aquota.user,jqfmt=vfsold /dev/vdb /mnt/f2fs mount -t f2fs -o remount,usrjquota=,jqfmt=vfsold /dev/vdb /mnt/f2fs umount /mnt/f2fs So, before old_qname and new_qname comparison, we need to check whether they are all valid pointers, fix it. The Linux kernel CVE team has assigned CVE-2025-40138 to this issue. Affected and fixed versions =========================== Issue introduced in 6.17 with commit d185351325237da688de006a2c579e82ea97bdfe and fixed in 6.17.3 with commit 3f3458852bbfe79c60f2412b8b04677b96688b6e Issue introduced in 6.17 with commit d185351325237da688de006a2c579e82ea97bdfe and fixed in 6.18-rc1 with commit 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c 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-40138 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/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/3f3458852bbfe79c60f2412b8b04677b96688b6e https://git.kernel.org/stable/c/930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c