Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp145334lqg; Wed, 10 Apr 2024 19:49:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMUK+ZMSgMxaWTL2dRr9P+C/7gdtmMrerVlnrvFlMr4dPpMxIzsoQn/H/RZLyZyeNX365rbByVQQhEL7CUPXuZQymLWfW27PBJGcHjGQ== X-Google-Smtp-Source: AGHT+IGrQ9moM4icvK6/E7+y+NUSWAvYY95E/WdjxiFNWb/rliK4+1bMXk3WFqRUack8VqDbXBdG X-Received: by 2002:a05:6a21:819b:b0:1a9:867b:c064 with SMTP id pd27-20020a056a21819b00b001a9867bc064mr145568pzb.41.1712803781710; Wed, 10 Apr 2024 19:49:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712803781; cv=pass; d=google.com; s=arc-20160816; b=uUtMVSK5hCVVaNoNYhW27TU/H6p67iV5JLKJVpHQ7x6r4Ju45BarOpfPQAIvtrtmeJ cSh52sxI7/jOakB87LAxru7NLjjRiANSUEDuD8YrgSLEi96kzMCim3uxgZLUSio3JY+u etTSN/kA/LAuTiiMzNX8MK9/g74nuGU1YO33eGtEjkPZ11Fc4gjTSS4ZaWsDzXfroczN 3vHzPkNBBYtYGhRM/laVlpKdiznwKgZSePZvWFCFbNhNvLrJRJFKXhgLZTgsWdx5C1IW zi373hswSgvMXyNDA5LRwrhNoffl9qjV1vr7/8fAJ9bItEHXcjNPzicD1n3wefuFGGU6 6hzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=TkanscJK2OJkfeFssea3/IKZK9CjvP0KFuQyZVzx4jQ=; fh=07tY2Pq954LwH29E4Va60q8BCfQAgxPAaoH2fcvz6yM=; b=Z6Z7FGCNyoY0hszMRD4ZuDjpEBURkoIpmQkZqxbxk//fs+M2YFeMetlNHANSd8QY8u GeNhOG+S6FjBQ4RC3AhyyhPY/O2RkhPOcD4JGmwAh78UqES1mta0CMyj1CC/o303+9Ko VXUP8KgsQKtkvizXPUtAei9PXTpRfYLy27dylf9Tpw+haJDgT4KSvMSqBw/J+loo/4lb xvaZFqklXVB1rh72SpFvjcEm1FSCkxqhmikOeBhOmJUlFDC+MZbubh22ktFh6WWavc/W CsLWD5OnFCDHls4wtUBx1n38efaCBryfMW91c1YLHz5nqEhkeGBSCFlJmPaRePS6C4/F dEeQ==; 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-139658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mc3-20020a1709032b0300b001e3fac93678si412459plb.290.2024.04.10.19.49.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 19:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-139658-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139658-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AF252287D58 for ; Thu, 11 Apr 2024 02:39:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D60B13B286; Thu, 11 Apr 2024 02:39:51 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 2FB045F870 for ; Thu, 11 Apr 2024 02:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712803191; cv=none; b=P3HgqXD9lathMDvJbxeekLxqpZQBYNUtrCkwNeeuZv5KhcseL7QVRvPXhxSi8HNzh4Asso7ytZOiarNtnpkBn/c6/tvoyVSQyH0SMGIP9LpNT+YiCDUmYywn2i5CIdxsMsBtK0bvf8JUVnrGnrJgV0Ylml0Z0VvMo3+GbV7FaOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712803191; c=relaxed/simple; bh=8sTXZZlPkCzR7YkcykYXAkUX7dCa064cGwilyQhpUuU=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=QByUgzH3IGXkOsLofeY5062BvtL4c3dyEb/EYoOY7W2I3T36H107dQ29AOHzEPcVGUAIq8rBCTvY+anSkfJTVk2qCy3Q4+9pyL1amP06+kTq/X/InVI86qP6Nm/NChsnyGSeEeGyRItyZoDgN7LoTRoIY0stRklIZdwn3FENw+E= 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.190 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.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VFP3T39Y7z29dPS; Thu, 11 Apr 2024 10:36:53 +0800 (CST) Received: from kwepemm600013.china.huawei.com (unknown [7.193.23.68]) by mail.maildlp.com (Postfix) with ESMTPS id E3D241A0172; Thu, 11 Apr 2024 10:39:45 +0800 (CST) Received: from [10.174.178.46] (10.174.178.46) 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; Thu, 11 Apr 2024 10:39:45 +0800 Subject: Re: [PATCH 2/2] ubi: ubi_init: Fix missed ubiblock cleanup in error handling path To: Daniel Golle CC: , , References: <20240410074033.2523399-1-chengzhihao1@huawei.com> <20240410074033.2523399-3-chengzhihao1@huawei.com> From: Zhihao Cheng Message-ID: <5d858fbc-11cb-8d02-a4b6-a640625c7e1d@huawei.com> Date: Thu, 11 Apr 2024 10:39:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600013.china.huawei.com (7.193.23.68) ?? 2024/4/11 7:10, Daniel Golle ะด??: > Hi! > > On Wed, Apr 10, 2024 at 03:40:33PM +0800, Zhihao Cheng wrote: >> The ubiblock_init called by ubi_init will register device number, but >> device number is not released 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 by running out of device number >> (dmesg shows that "__register_blkdev: failed to get major for ubiblock"). >> Fix it by invoking ubiblock_exit() in corresponding error handling path. > > Thank you for taking care of this issue. > > See my comment inline below: > >> >> Fixes: 927c145208b0 ("mtd: ubi: attach from device tree") >> Signed-off-by: Zhihao Cheng >> --- >> drivers/mtd/ubi/build.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c >> index 7f95fd7968a8..354517194099 100644 >> --- a/drivers/mtd/ubi/build.c >> +++ b/drivers/mtd/ubi/build.c >> @@ -1380,12 +1380,13 @@ static int __init ubi_init(void) >> if (ubi_is_module()) { >> err = ubi_init_attach(); >> if (err) >> - goto out_mtd_notifier; >> + goto out_block_exit; >> } >> >> return 0; >> >> -out_mtd_notifier: >> +out_block_exit: >> + ubiblock_exit(); > > I believe that this call is the reason for the section mismatch we > are seeing on Intel's kernel test builds: > > https://lore.kernel.org/oe-kbuild-all/202404110656.wLLc5mHR-lkp@intel.com/ > > Also note that Ben Hutchings has supplied a more complete and imho > better solution for this problem, which yet still suffers from the > same problem (calling __exit function from __init function which > results in section mismatch). > My mistake, I always forget to check make W=1, I will send a new version to combine Ben's modifications. Thanks to point that. > >> unregister_mtd_user(&ubi_mtd_notifier); >> out_debugfs: >> ubi_debugfs_exit(); >> -- >> 2.39.2 >> > . >