Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp73999lqg; Wed, 10 Apr 2024 16:11:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXpQ+F85RNnqIa3ukVqx0scWcgUVA1a3RgoDvONq6U17XYxTZhFGgT2tS9U3d9pH/edyLENdwFEr4UFKagw4AmE1tiINkqsTmudyC/n9g== X-Google-Smtp-Source: AGHT+IEwaSEdWRz0mzq4IMoF2S0fCdxaVFFFAogLf2PBy/b8adOTZ2nNGRZzxCyQG4Ztg15+dJ4S X-Received: by 2002:a17:902:c408:b0:1de:e5aa:5ce with SMTP id k8-20020a170902c40800b001dee5aa05cemr4400594plk.41.1712790680829; Wed, 10 Apr 2024 16:11:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712790680; cv=pass; d=google.com; s=arc-20160816; b=VcgmitVyWeoGys7PJI5uCNjkefDjpRxNijHOzkLTVl/sAVSDFbdwS92XU8ll8zLWtU 51hlVgRx8NTd5SwfqOMJ17J+LI7YlwfcoInG3BR3rqeZQ6nTM8LmyWuJ9bwZ1h66Oou9 FhAGsZb1kYBH+8QOl9pPgk/1M94kixHSbK6MmXj/S+F2YPhCX6bEXCPpRBtcxv+U2l3S 5S2EJfplukfOox5Mb+GMKOY6XSRtaKhoBmpFuCvrr0vUd49zroqzLRY7JAFAbmAcuGaS RlaQMEegNy21aAkAAUDbI9QOvzYPBOSkVjgntMRl9eSOjm1+HA+esZdZNEfek4K1yVPZ S9PA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=gvRUS7/YrJhbMtpAy5ST1Won0nHc649PpOIoKYZ6bXE=; fh=AP/H5WS9cI5BfHoFIYm8nCjow+AinWz69sQHGPHn26s=; b=jSCMU4UgWAc3lGdhOWrrvQhjXzfZxYBmPUp3o48kZWChOBR3W/oLXauSRwmEcaOorW Ysf9wxKn5bmOvU026mutnzbhsvbq+IPVHQM9GWkDEgp5aD5r42yYrBWKdeEimi8QzU5r 0I/m2TNjftBDPTC+6EOzHSTNYfs7qakDrRcFWyyyXCP+cGrgkwD/x3QurVNXgKE0ulpG yIqVv/FD9PkW8FSv+pne2d1jheWmKLMsLdu7/p1Sb0g7KRDkeu8qS1D4pOQe6QYUeWoH katm85u3hrUhpX7nHzNEE+LP/sM7PLvtOAX9JCKowDXZwlIjW2SLLyhDDFsNt3BH6ABv /pjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-139514-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139514-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j11-20020a170903024b00b001e506539e21si123911plh.313.2024.04.10.16.11.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 16:11:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139514-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=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-139514-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139514-linux.lists.archive=gmail.com@vger.kernel.org" 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 81B59288695 for ; Wed, 10 Apr 2024 23:11:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8018F1F954; Wed, 10 Apr 2024 23:11:14 +0000 (UTC) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 C9C24138E for ; Wed, 10 Apr 2024 23:11:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712790674; cv=none; b=qDWRxXqNa7o1yWkJgWVvBfGBPhSOIVV4XSrGgGTtZcIRGWDr5DgjAgxPjGXthkoRGut/b0T4EK8Wlmz+P717IIRHIMIerF1pESYqIZ71fW8AKyacK0ONZfG/plWiOUgj0zj/gO20ASPzSVsDryOYmeQeVOuCKbfb83hp0Xzs018= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712790674; c=relaxed/simple; bh=lzJuj20VpCLHchg2/Zfcm06SxrZ/tTwWdpqLy19ZBN4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sNlh1p66agHCNh368+xVTbuzHLMnk9ri5TMP97HZI8ZyoY2+SmQRGb67sAb/lGn3Dfk8oeAiEnkiPUvgjhQywBk/GZkF3UPN/VkXw8vAr2ch1SbWwRpipNsYClnpet86kqGqzn0L/3Bk2OGmwHP5UCjFKL47jN+VFM7bK/9u77g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1ruh5l-0002ER-22; Wed, 10 Apr 2024 23:10:57 +0000 Date: Thu, 11 Apr 2024 00:10:55 +0100 From: Daniel Golle To: Zhihao Cheng Cc: richard@nod.at, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] ubi: ubi_init: Fix missed ubiblock cleanup in error handling path Message-ID: References: <20240410074033.2523399-1-chengzhihao1@huawei.com> <20240410074033.2523399-3-chengzhihao1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240410074033.2523399-3-chengzhihao1@huawei.com> 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). > unregister_mtd_user(&ubi_mtd_notifier); > out_debugfs: > ubi_debugfs_exit(); > -- > 2.39.2 >