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 846202578 for ; Wed, 7 Jun 2023 20:33:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F406C433D2; Wed, 7 Jun 2023 20:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686169985; bh=gIrpZpxqj2DyurvKFclCP8BFpxcD1gYPzqvWChT/VT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7WC5jcJBy1i/2RLc+N/Zb66nAj5lzbun1aV6ohHum26aKDII8BHHgY60Vs4suTOW NSfqHe87ailoi2ZRBO+zJNUp3bnxJrNrLoTDB3IdK48At9ZQ/A2sVlyqnlHBCB9Zhb rIJFelH/V92sjN7o9HFNIa3LPu6pn9xLIySp8aUo= 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 6.3 261/286] ext4: disallow ea_inodes with extended attributes Date: Wed, 7 Jun 2023 22:16:00 +0200 Message-ID: <20230607200931.838530800@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607200922.978677727@linuxfoundation.org> References: <20230607200922.978677727@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 @@ -4841,6 +4841,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";