From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=61.135.153.165 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796036743; b=e+gCa1hOgNOCuEviuSUJu6tO4oVJpc9mfBMBX0e/MazfBeEA/PYKGDiMKSoMKmHKdEQO f6t1PMlbwDp5O5Uuc5fZ4YK0XblHIicirIBWv7ByQItnTzS23lxx0e8CoAucC5rsVWPol 9B/dXIvwh3zFp0PlhM2M1xRQ0e5cEAk4TjqVSshg0/APx9rzW9+C2QpPr9a58+9/CCgFy vd7OW4H3N3IH2px1SY9qc+HxzJnPkDI6UIe3uNeqzhe6jV4ubx77WVC2BKLwYIe386rXt 9EVMC0lPJNn2WbFcXLnE/1wUWOHSMixBjVxOoq/ygq3nFo9zmFkY+uwsM+ouaJ7Nx7A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036743; h=DMARC-Filter:DKIM-Signature:X-SMAIL-HELO:Received:X-Sender:X-Auth-ID: X-SMAIL-MID:X-SMAIL-UIID:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=xUHE0rzAGG0i3BCLH7uYE/X5xCSKhC3s5LdrQ6+dySc=; b=zraxgbLwen+bBXw7T/eC79xAkZRtmuA5wiSxUFo/0gUkxMct7l6oAnQ0o89U0sfkW0hF X0P+AGqkNQS2zV9Ab/gyiTH0g+Snb3fEXaQ3YTxrPAkB/KYmJ5HBQ63fUQo5DqRZFH3TM nmlaS3ZKWJn2fhdEnVlymKHcS/EjxlAxXkB2dvJzsa+P7eXXU78XMBaweXn+W9F8fXgBQ sIqTBSctTRRBVtLYSeoisRAyOLiyaiDRi5ysMIKuabW+zJr9fru8E3CtaAe5LAZedt3bE 3BXHF6paU1runDJ2sgwjLDAe4ew+mz/mILprReyMsRmKzt9FohYTwXrVaLQ9CAPpViA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass header.d=sina.com header.i=@sina.com header.a=rsa-sha256 header.s=201208 header.b=z3rPdU60; arc=none smtp.remote-ip=61.135.153.165 Received: from smtp153-165.sina.com.cn (smtp153-165.sina.com.cn [61.135.153.165]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 809E1606A320 for ; Mon, 30 Nov 2026 11:05:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 809E1606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.a=rsa-sha256 header.s=201208 header.b=z3rPdU60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1796036739; bh=xUHE0rzAGG0i3BCLH7uYE/X5xCSKhC3s5LdrQ6+dySc=; h=From:Subject:Date:Message-ID; b=z3rPdU60bBiMM7zR39Tc9U3YHcAJYTEjFFPUF9Yzv74z0xCBSTG1imHwFLqzGWBp9 3f4xlWkMaBY7Bpyn7z7QPPGCZVJzqShaJGb95+WtoW5oIFkMiB5UjYXXNhw07d0Dxy KwHOIrRY7Jc1uP9PF9L2gJk8l5PZjGOmorxKiiv0= X-SMAIL-HELO: lxu-pcd Received: from unknown (HELO lxu-pcd)([111.198.225.163]) by sina.com (10.54.253.32) with ESMTP id 6B0D587600005E89; Mon, 30 Nov 2026 19:05:29 +0800 (CST) X-Sender: eadavis@sina.com X-Auth-ID: eadavis@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=eadavis@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=eadavis@sina.com X-SMAIL-MID: 5159164456697 X-SMAIL-UIID: 15B987859FF24BD8847380E0A377E838-20261130-190529-1 From: Edward Adam Davis To: syzbot+68178aa1e39c8606392e@syzkaller.appspotmail.com Cc: djwong@kernel.org, jack@suse.cz, krisman@kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, tytso@mit.edu Subject: [PATCH] ext4: Add validity checks for the casefold feature Date: Mon, 30 Nov 2026 19:05:26 +0800 Message-ID: <20261130110526.116017-1-eadavis@sina.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <6b0ce1e1.8ccee5ca.1045fd.02b4.GAE@google.com> References: <6b0ce1e1.8ccee5ca.1045fd.02b4.GAE@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The EXT4_FEATURE_INCOMPAT_CASEFOLD feature is not enabled during the file system mount process; consequently, s_encoding is not loaded into the superblock. When the EXT4_FEATURE_INCOMPAT_CASEFOLD feature is enabled via EXT4_IOC_SET_TUNE_SB_PARAM, sb->s_encoding is not initialized. After the EXT4_CASEFOLD_FL flag is set on a dir via ext4_ioctl_setflags(), the lookup operation performed on that directory triggers a call to the ext4_fname_setup_ci_filename() function. This function passes the NULL value of dir->i_sb->s_encoding to utf8_casefold(), which subsequently leads to a null-ptr-deref of um->tables within utf8nlookup(). Added validity checks related to casefold feature to prevent referencing an uninitialized encoding. Fixes: 04a91570ac67 ("ext4: implemet new ioctls to set and get superblock parameters") Reported-by: syzbot+68178aa1e39c8606392e@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=68178aa1e39c8606392e Signed-off-by: Edward Adam Davis --- fs/ext4/ioctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 83630cd40712..48d30c529490 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1464,7 +1464,10 @@ static int ext4_validate_tune_sb_params(struct super_block *sb, (params->clear_feature_incompat_mask & ~EXT4_TUNE_CLEAR_INCOMPAT_SUPP) || (params->clear_feature_ro_compat_mask & - ~EXT4_TUNE_CLEAR_RO_COMPAT_SUPP)) + ~EXT4_TUNE_CLEAR_RO_COMPAT_SUPP) || + (params->set_feature_incompat_mask & + EXT4_FEATURE_INCOMPAT_CASEFOLD && + !sb->s_encoding)) return -EOPNOTSUPP; /* -- 2.43.0