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 10509848C for ; Fri, 10 Mar 2023 14:22:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84133C433D2; Fri, 10 Mar 2023 14:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678458123; bh=dWaOxSTuuVnsoufbcY5U6XTajXN1PhzScfpEn9gN9EU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RnQgW53u88Tz8taqKRG6QpZguAevwnOU8sR6M6Y7XVsId9j+OQHh0OSPKy739YJzQ 07n+9OpUkvBlrF9bMDufhjSSyXE7EgbVXQ9UYChXa0RCL0Zb1e9FnDSY1qYSy5amBp IrLhMkZYeRYE3jq7eE51cnKrTs8KJ4GbjnCnfve8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+2dacb8f015bf1420155f@syzkaller.appspotmail.com, stable@kernel.org, Jun Nie , Theodore Tso Subject: [PATCH 4.19 172/252] ext4: refuse to create ea block when umounted Date: Fri, 10 Mar 2023 14:39:02 +0100 Message-Id: <20230310133724.067471607@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133718.803482157@linuxfoundation.org> References: <20230310133718.803482157@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: Jun Nie commit f31173c19901a96bb2ebf6bcfec8a08df7095c91 upstream. The ea block expansion need to access s_root while it is already set as NULL when umount is triggered. Refuse this request to avoid panic. Reported-by: syzbot+2dacb8f015bf1420155f@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?id=3613786cb88c93aa1c6a279b1df6a7b201347d08 Link: https://lore.kernel.org/r/20230103014517.495275-3-jun.nie@linaro.org Cc: stable@kernel.org Signed-off-by: Jun Nie Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/xattr.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1436,6 +1436,13 @@ static struct inode *ext4_xattr_inode_cr uid_t owner[2] = { i_uid_read(inode), i_gid_read(inode) }; int err; + if (inode->i_sb->s_root == NULL) { + ext4_warning(inode->i_sb, + "refuse to create EA inode when umounting"); + WARN_ON(1); + return ERR_PTR(-EINVAL); + } + /* * Let the next inode be the goal, so we try and allocate the EA inode * in the same group, or nearby one.