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 76D8D30F813 for ; Mon, 15 Sep 2025 14:21:52 +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=1757946112; cv=none; b=lu4ABiCcZ2UkMeJFqzZgULi+WfG4UOhAotAcjnIkasi6A5b94eO/Nt0rYzL8cmFoE/lYoir9OXA0PrjoR0DQyojLeR/UTQPnUDcRbx7kHhdfocPw1qYhQv5XGwVtBL5grijqN/GRFIAwgL2Uyb7CNtG4yW1hixdizPZXHL4MdwU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757946112; c=relaxed/simple; bh=iszahrAz/gUvLSZCf/hpxkS8kymYqx4v/npsiwUKLkY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OmgKp1/A/neb0YrZ7Z39OwVZCaUVI/nKWGzu+QCUQabIk00zbULszMNTGu/Tm4f2R/8GdYd35vE8gxCUiXb00PU/SZcquJGLaIGlU+/mBRAumxNy55qVUxM0hiUdHOy+Gmc69g9JC8PDpONkf+fDFifZMz1sv6KiZBEaovYFeYI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GQ8FuaCI; 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="GQ8FuaCI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FE23C4CEF1; Mon, 15 Sep 2025 14:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757946112; bh=iszahrAz/gUvLSZCf/hpxkS8kymYqx4v/npsiwUKLkY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=GQ8FuaCI2U2PY8VDGBCnWfSWRGl7tDQ2dS391A9WzQoh+7zrS7fXmOKkYPMigxHAM 42kt6Wir3zvL4O5GpNYJPbqdkNXoK4HeSKbraGyZcZkkm2uiVHRlNaO20ibZPEMTeV zf9Tpu8dLVbLqxV8o6fyR5UT2Q1ncCDwzfT20YYY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50277: ext4: don't allow journal inode to have encrypt flag Date: Mon, 15 Sep 2025 16:21:19 +0200 Message-ID: <2025091506-CVE-2022-50277-085f@gregkh> X-Mailer: git-send-email 2.51.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=3160; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=jQgfkwEWXU2I80HcrLLba/8pi9sqddvoUzeoapMwWV4=; b=owGbwMvMwCRo6H6F97bub03G02pJDBknFC61H+u5++z11r1nMy7L3vPdyH+re8JCrc6nGaWd5 6bs3PJ9Z0csC4MgE4OsmCLLl208R/dXHFL0MrQ9DTOHlQlkCAMXpwBM5M4VhgULA99c/GCu8dzd S+1fDke5zidm7/kM85Nnnfl7/toqRqP8/X1XThUeVGGVmg4A 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: ext4: don't allow journal inode to have encrypt flag Mounting a filesystem whose journal inode has the encrypt flag causes a NULL dereference in fscrypt_limit_io_blocks() when the 'inlinecrypt' mount option is used. The problem is that when jbd2_journal_init_inode() calls bmap(), it eventually finds its way into ext4_iomap_begin(), which calls fscrypt_limit_io_blocks(). fscrypt_limit_io_blocks() requires that if the inode is encrypted, then its encryption key must already be set up. That's not the case here, since the journal inode is never "opened" like a normal file would be. Hence the crash. A reproducer is: mkfs.ext4 -F /dev/vdb debugfs -w /dev/vdb -R "set_inode_field <8> flags 0x80808" mount /dev/vdb /mnt -o inlinecrypt To fix this, make ext4 consider journal inodes with the encrypt flag to be invalid. (Note, maybe other flags should be rejected on the journal inode too. For now, this is just the minimal fix for the above issue.) I've marked this as fixing the commit that introduced the call to fscrypt_limit_io_blocks(), since that's what made an actual crash start being possible. But this fix could be applied to any version of ext4 that supports the encrypt feature. The Linux kernel CVE team has assigned CVE-2022-50277 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit 38ea50daa7a447dbcd7031f37a39a1baa163b2ab and fixed in 6.0.18 with commit 1f7a6626f611aa06d7907aa45b484708dd5ac8bc Issue introduced in 5.18 with commit 38ea50daa7a447dbcd7031f37a39a1baa163b2ab and fixed in 6.1.4 with commit bcc5057e1781a3ee889225480d995c3b5cbde555 Issue introduced in 5.18 with commit 38ea50daa7a447dbcd7031f37a39a1baa163b2ab and fixed in 6.2 with commit 105c78e12468413e426625831faa7db4284e1fec 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-2022-50277 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/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/1f7a6626f611aa06d7907aa45b484708dd5ac8bc https://git.kernel.org/stable/c/bcc5057e1781a3ee889225480d995c3b5cbde555 https://git.kernel.org/stable/c/105c78e12468413e426625831faa7db4284e1fec