From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42A3FC77B7A for ; Wed, 7 Jun 2023 21:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235787AbjFGVDg (ORCPT ); Wed, 7 Jun 2023 17:03:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235870AbjFGVDK (ORCPT ); Wed, 7 Jun 2023 17:03:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C47A3270F for ; Wed, 7 Jun 2023 14:02:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5EDFF648DA for ; Wed, 7 Jun 2023 21:02:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BFA8C433EF; Wed, 7 Jun 2023 21:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686171759; bh=nimzWmEZFrQvdetXqNVc1L3824RtmvJAgokIqJRobA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jm/a1003dhzeWz2QpJWTZ0gX6wBloiyC4RE4LNrvrlfJ97MmFtH2uYWJHMFxxK03X 4S4HvqKxNxAD+EDNbLZQx4VZoYPOSdu+PEKv1Qs1i3N7HcmD/Yvt6KOvIdOdLOFh/E QvQ0SoGIeCCKGMAX5PlhAn7hAbX+VQpVocpmrY3A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, syzbot+e44749b6ba4d0434cd47@syzkaller.appspotmail.com, Theodore Tso Subject: [PATCH 5.15 138/159] ext4: disallow ea_inodes with extended attributes Date: Wed, 7 Jun 2023 22:17:21 +0200 Message-ID: <20230607200908.184727212@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607200903.652580797@linuxfoundation.org> References: <20230607200903.652580797@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Theodore Ts'o commit 2bc7e7c1a3bc9bd0cbf0f71006f6fe7ef24a00c2 upstream. An ea_inode stores the value of an extended attribute; it can not have extended attributes itself, or this will cause recursive nightmares. Add a check in ext4_iget() to make sure this is the case. Cc: stable@kernel.org Reported-by: syzbot+e44749b6ba4d0434cd47@syzkaller.appspotmail.com Signed-off-by: Theodore Ts'o Link: https://lore.kernel.org/r/20230524034951.779531-4-tytso@mit.edu Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4598,6 +4598,9 @@ static const char *check_igot_inode(stru if (flags & EXT4_IGET_EA_INODE) { if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) return "missing EA_INODE flag"; + if (ext4_test_inode_state(inode, EXT4_STATE_XATTR) || + EXT4_I(inode)->i_file_acl) + return "ea_inode with extended attributes"; } else { if ((EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) return "unexpected EA_INODE flag";