Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7075613rwl; Fri, 30 Dec 2022 03:17:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXtNF6YG7UBnAfBHAMxDb9rysxRTXaRNuQW/cqNEIqMCBDVD6c9piixUgxvSKHloh0zE+eVf X-Received: by 2002:a17:902:a98a:b0:189:cef2:88e3 with SMTP id bh10-20020a170902a98a00b00189cef288e3mr33570635plb.57.1672399029514; Fri, 30 Dec 2022 03:17:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672399029; cv=none; d=google.com; s=arc-20160816; b=ayKuP3Stnk+J7PU4/FTdvq98jWMXjLdLHlkO0yXMDK4iuMnylBVWvNp5GRz7Gd2BV5 nEiW4dNHuae9VefvdPxkfDxmCfYggg8PUXprhbGPgDE6NhM73D5QHKV0lmtr0lohJTKF BOafZf/sNo4GdfIzZSNg8rPMYvTpdXkGYJDEXkuB1L7v2wwNmqEnVzKVxGWNWjXHJ43F YYXbdbF4gQw4ksIFQjSxCAzy9YMSP0Bm7Q/DxL1hC1FRxfUcd9xtKvSh8EUZxEXStEnM y8JgsoMMYOf8vhqQeARge5pLwNXcFkcqdjbSp3xz0EN+0JipVb9Fpk+5Dz9pHjfLNTxv kxyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ahkStRU6mZ/j+Lj49hs0SrtIZtOi4h+JM4lKoZJx6Y0=; b=wfBox1aChfKW56eikZU6OkgCEipCn5czr6kH8bddW2XlVA9R6vi8//CLhvbtohnj/+ FYqVXrtmOs83jI5aMooetSbdoew+pplkk1dAbCVOKSOqg+KKoCGdD9xLnQoZqASsnXu3 zQBRHMYNP+YV7Qkt299XMJmZjNHRUlmByWh8+AsNiDFonK9pTgarOxJVq10VW512akZW 8Kb2LMXbx0dIITLOXV91rmyW+DN7MKAg7VZtwvFyU1J9mKWjtl2APbK+NmYmxkSnuxBX dUPJzGyvd2TdtYjTwHG1Af/DaHkp4uX4cC1R9RKspSYS9dWnkhORKKP/upP2bQXwZLF3 STog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e3HEINbn; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a17-20020a170902ee9100b00186a185131asi19800615pld.0.2022.12.30.03.16.49; Fri, 30 Dec 2022 03:17:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e3HEINbn; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234629AbiL3LAF (ORCPT + 99 others); Fri, 30 Dec 2022 06:00:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbiL3LAC (ORCPT ); Fri, 30 Dec 2022 06:00:02 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0910F1A3B4 for ; Fri, 30 Dec 2022 03:00:02 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id ge16so18272279pjb.5 for ; Fri, 30 Dec 2022 03:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ahkStRU6mZ/j+Lj49hs0SrtIZtOi4h+JM4lKoZJx6Y0=; b=e3HEINbnqThpfVCwEBmANE9t6wazfU0CqSlTPViHpaoGjovSAYUApwjFm3t8bmC8l6 msnEcLQsf9yJERT6yLriiVMPvG/rqyHdhMf7Oc4EVeTnLUlny2erObvsxbvgWLc94I0I Hfp398jakVZquSf0v2Q9BHn1P6pKwBQHP5I/dLz8yzRL9RQxcpX34Zxq9OvNceDdZeyw SzgJQgzUYuE2KS+7/VcVwbRdxLh6rmG4s8b1YGed1CLJSkOoRtVcy4imn6UJsTICbBWQ /pEPtUxYaFybK7GN6cWXHifeJEDCzReTOMtohU/fvz18qaMAUIZZH5Gnwn+xEAQ/wB/2 eufg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ahkStRU6mZ/j+Lj49hs0SrtIZtOi4h+JM4lKoZJx6Y0=; b=mCCuL/51K8RnWeKTWNY5Z40nVGnpeorRy26MOpOZPywqAVkPXArGPllIultdzrNdSE kaB2MAyn9DlV39daNrYiW/VuUE1roYPO34L+FqTfkq0iClFsSO8SuWyWQ2h+nEs6hAl/ ZTzWiUbJGSfq1F4AACZbJ1b5SUonjrVqKmMlzaaKdjFzQio2b6iuh/dK4tq6tusHoGzY yVEi0JZciJwSXbIshkjgZk96TQD3jhGX/VpO6jaBmHL9WjLZNjBx6Jmwml6nFkUqqDmr 3WSZb5fXnPLYYrJufg99OQP2CfpvylgeJ+DCEKriWUFjp5jAfnuo2Xh2gfKLa9RtgsZ1 Jk9A== X-Gm-Message-State: AFqh2kr35nYOgm9xp2+Jb45BG/JLeJB/N5h/pCPJbm2ShTpVOwMQh9lo 6EjfI8yGrU6hEx1LWtBGjHiSZp/ck+lE+FQi X-Received: by 2002:a17:902:848d:b0:189:5f5c:da1d with SMTP id c13-20020a170902848d00b001895f5cda1dmr31017474plo.18.1672398001764; Fri, 30 Dec 2022 03:00:01 -0800 (PST) Received: from niej-dt-7B47.. (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id n6-20020a170903110600b00186a437f4d7sm14662525plh.147.2022.12.30.02.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 03:00:01 -0800 (PST) From: Jun Nie To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Cc: tudor.ambarus@linaro.org Subject: [PATCH 2/2] ext4: refuse to create ea block when umounted Date: Fri, 30 Dec 2022 19:00:16 +0800 Message-Id: <20221230110016.476621-2-jun.nie@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221230110016.476621-1-jun.nie@linaro.org> References: <20221230110016.476621-1-jun.nie@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 Signed-off-by: Jun Nie --- fs/ext4/xattr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 235a517d9c17..ac58494e49b6 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1422,6 +1422,12 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle, uid_t owner[2] = { i_uid_read(inode), i_gid_read(inode) }; int err; + if (inode->i_sb->s_root == NULL) { + ext4_error(inode->i_sb, + "refuse to create EA inode when umounting"); + 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. -- 2.34.1