Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp258902lqe; Wed, 10 Apr 2024 00:49:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXU1pmfJthKyR5taWlzWlNdlzrJ+Rf2Hxi4pEL5aGL2dEFugtswlZMj9pVzxcsRkuvOK3/Ue/fsVYDYZ7sVFcVQLo9ffNlFZzlNQ/WpTA== X-Google-Smtp-Source: AGHT+IELBt8wBAiy/XoEasnJSbaUeSirkkQxa6yEKMb5FMG50mYmOeKDcCKDH+nQPCt6aELinv0s X-Received: by 2002:a05:6214:f2e:b0:699:15b3:efd2 with SMTP id iw14-20020a0562140f2e00b0069915b3efd2mr2167384qvb.3.1712735357341; Wed, 10 Apr 2024 00:49:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712735357; cv=pass; d=google.com; s=arc-20160816; b=ULmlYrhSW5jviX9cLbDEtBjJrBSIhX04Hekymq1B5V0KPLVc/x/mznca1SzLJCjUgE NbiUoc/eCS8HOsIcEZm3d23Kc71DH51nFrXXwFMRcQ+S+3UzeExuIEEJMTfJWIzwoe2O 8LaBiDtB9sKq9s6hv9IbjYTPx56KSEgovVofNoci5R5yRAJVnunJuG7l8L1x9Fu8B23d UsDISR+IfnWiVNTsM6KfGmnNAA+dBRuOkRScTx0Mz6dD0CwV6w/4edieBgRXYNnkwZUH QMp2VwfhDdQZPm3IpYOVGumUtcKq05R4YrCA9XvsJ8RPqEYZJl88tMkhdzrRy6JOUHYS Irqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=P2rogxsBAr4T/Gc6gojhTL0pyU7ypZcBPsbvz+x4cO0=; fh=aZfR5YSFISY32Oi9C96GHuHzU6Vg3tZeBKoYnD+6/t0=; b=X4ZrJJ9niEzcauYTLypsfmMuwFKMaNsY6FbLR+Nuaj0TBAn2RN1JL4bQpjKJQH/x3i DNww3c4QX331Nd6wCso1BHIp2YHUNS+rkyBTbLQCzJfOVcnr7zO4UqBIZKJ6r+0CXqT1 j0ZTtjIcAu8uFDngcvp9SRRjtrXmFLmf5lBGXplwidtm9qWubXMRzdWCiZ/5q7K6QMiM Drf44sFJDDVkepp94QeBHTt5GfM7gHZ7rz9OD9KANhs7ca+CBQbGXJVlrufYGMz3Uyyg eAr+TU+09wtc6jyxXp4MoYkX2spPuLYYU74ZfDrGKBtmlpUXz/V0tgDi6TLMgcotpGCJ 0yAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-138100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138100-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w8-20020a0562140b2800b0069b1ece8a44si5243299qvj.470.2024.04.10.00.49.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 00:49:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-138100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138100-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 01F2C1C2133D for ; Wed, 10 Apr 2024 07:49:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5ACE213D28B; Wed, 10 Apr 2024 07:49:10 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (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 92E548BE8 for ; Wed, 10 Apr 2024 07:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712735349; cv=none; b=dtqUCkl1W+OAidBRENDtgFPmhC6oKAB7Xj7C2sSho1Masr97k2moQZFypB98YPA8UeiipVYAe0kHwWIpeMJVGi4vFeXaN5j63lJXOmelroRftUwJ52AdFmpFxJpvWBmRihb57cxjIsnxGzLIyZB/mciCz7VhjzKoUi3D3tpv38A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712735349; c=relaxed/simple; bh=L7+yEMnAAQhrm90UXztYYYVX1BAD5yIkJu/9V9n1ex4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b/Ff/butnNa2n9KYhZbkEYQWtqOMgeHuIfVv8sbxLKNaSudF6XYJJbdex5hLfGo8rDOJ9CTQsFgm7TsQBiITc02RfdqiXMA2fpZe6RnFBIGfHmiALnSDPEsOKr2qeFEovsGq3h5y0RMT0DZW7LQbqWzoXhNSEs195FKIEimYbGk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4VDvzY3YCfzNnVX; Wed, 10 Apr 2024 15:46:49 +0800 (CST) Received: from kwepemm600013.china.huawei.com (unknown [7.193.23.68]) by mail.maildlp.com (Postfix) with ESMTPS id 7510118005D; Wed, 10 Apr 2024 15:49:05 +0800 (CST) Received: from huawei.com (10.175.104.67) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 10 Apr 2024 15:49:04 +0800 From: Zhihao Cheng To: , CC: , Subject: [PATCH 1/2] ubi: ubi_init: Fix missed debugfs cleanup in error handling path Date: Wed, 10 Apr 2024 15:40:32 +0800 Message-ID: <20240410074033.2523399-2-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410074033.2523399-1-chengzhihao1@huawei.com> References: <20240410074033.2523399-1-chengzhihao1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600013.china.huawei.com (7.193.23.68) The debugfs dir is created in ubi_init, but it is not destroyed in error handling path of ubi_init when ubi is loaded by inserting module (eg. attaching failure), which leads to subsequent ubi_init calls failed. Fix it by destroying debugfs dir in corresponding error handling path. Fixes: 927c145208b0 ("mtd: ubi: attach from device tree") Signed-off-by: Zhihao Cheng --- drivers/mtd/ubi/build.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index a7e3a6246c0e..7f95fd7968a8 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -1372,7 +1372,7 @@ static int __init ubi_init(void) /* See comment above re-ubi_is_module(). */ if (ubi_is_module()) - goto out_slab; + goto out_debugfs; } register_mtd_user(&ubi_mtd_notifier); @@ -1387,6 +1387,8 @@ static int __init ubi_init(void) out_mtd_notifier: unregister_mtd_user(&ubi_mtd_notifier); +out_debugfs: + ubi_debugfs_exit(); out_slab: kmem_cache_destroy(ubi_wl_entry_slab); out_dev_unreg: -- 2.39.2