Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752601AbbBAXHb (ORCPT ); Sun, 1 Feb 2015 18:07:31 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:58287 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbbBAXH3 (ORCPT ); Sun, 1 Feb 2015 18:07:29 -0500 Date: Sun, 1 Feb 2015 15:07:23 -0800 From: Brian Norris To: Niklas Cassel Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: avoid registering reboot notifier twice Message-ID: <20150201230723.GA3523@norris-Latitude-E6410> References: <1422752930-696-1-git-send-email-nks@flawful.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422752930-696-1-git-send-email-nks@flawful.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1324 Lines: 34 On Sun, Feb 01, 2015 at 02:08:50AM +0100, Niklas Cassel wrote: > Calling mtd_device_parse_register with the same mtd_info > (e.g. registering several partitions on a single device) > would add the same reboot notifier twice, causing an > infinte loop in notifier_chain_register during boot up. No driver should be calling mtd_device_parse_register() multiple times on the same mtd_info. Under what context do you see this? What driver? > Signed-off-by: Niklas Cassel > --- > drivers/mtd/mtdcore.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c > index de79576..98efc1e 100644 > --- a/drivers/mtd/mtdcore.c > +++ b/drivers/mtd/mtdcore.c > @@ -556,7 +556,7 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types, > err = -ENODEV; > } > > - if (mtd->_reboot) { > + if (mtd->_reboot && !mtd->reboot_notifier.notifier_call) { > mtd->reboot_notifier.notifier_call = mtd_reboot_notifier; > register_reboot_notifier(&mtd->reboot_notifier); > } Brian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/