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 13F31C7EE2E for ; Wed, 7 Jun 2023 20:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235262AbjFGUwa (ORCPT ); Wed, 7 Jun 2023 16:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235280AbjFGUwY (ORCPT ); Wed, 7 Jun 2023 16:52:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DBBE79 for ; Wed, 7 Jun 2023 13:52:23 -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 1406A64764 for ; Wed, 7 Jun 2023 20:52:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2874AC433EF; Wed, 7 Jun 2023 20:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686171142; bh=93y0fy3jAXlSvG0Uv7InDyw1KvoaHnvub+n/ZAk6SXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nwwkEDvHN+wrOSGv4l08QLpRpXIIofoiOYPs9acGaZANWo9i7NspOoqSjJD9OFCfy Tf8kBZeH5iLFtTsUInSqOPuI+q6eWHTeDlkU9nqSisCmyvROi4IBcH+psSBWUlxFr9 dL6nTGhhYHdEJZpJhTOb0Mj8o1Ev/CnxjzmSMeW8= 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.10 101/120] ext4: disallow ea_inodes with extended attributes Date: Wed, 7 Jun 2023 22:16:57 +0200 Message-ID: <20230607200904.096230979@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607200900.915613242@linuxfoundation.org> References: <20230607200900.915613242@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 @@ -4686,6 +4686,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";