All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <nks@flawful.org>
To: Brian Norris <computersforpeace@gmail.com>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: avoid registering reboot notifier twice
Date: Mon, 02 Feb 2015 08:08:17 +0100	[thread overview]
Message-ID: <54CF2261.1040707@flawful.org> (raw)
In-Reply-To: <20150201230723.GA3523@norris-Latitude-E6410>


On 02/02/2015 12:07 AM, Brian Norris wrote:
> 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?
arch/cris/arch-v32/drivers/axisflashmap.c

It calls mtd_device_register for different partitions on same device using the same mtd_info.

What do you suggest this driver should do instead?

>
>> Signed-off-by: Niklas Cassel <nks@flawful.org>
>> ---
>>  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

WARNING: multiple messages have this Message-ID (diff)
From: Niklas Cassel <nks@flawful.org>
To: Brian Norris <computersforpeace@gmail.com>
Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: avoid registering reboot notifier twice
Date: Mon, 02 Feb 2015 08:08:17 +0100	[thread overview]
Message-ID: <54CF2261.1040707@flawful.org> (raw)
In-Reply-To: <20150201230723.GA3523@norris-Latitude-E6410>


On 02/02/2015 12:07 AM, Brian Norris wrote:
> 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?
arch/cris/arch-v32/drivers/axisflashmap.c

It calls mtd_device_register for different partitions on same device using the same mtd_info.

What do you suggest this driver should do instead?

>
>> Signed-off-by: Niklas Cassel <nks@flawful.org>
>> ---
>>  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


  reply	other threads:[~2015-02-02  7:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01  1:08 [PATCH] mtd: avoid registering reboot notifier twice Niklas Cassel
2015-02-01  1:08 ` Niklas Cassel
2015-02-01 23:07 ` Brian Norris
2015-02-01 23:07   ` Brian Norris
2015-02-02  7:08   ` Niklas Cassel [this message]
2015-02-02  7:08     ` Niklas Cassel
2015-02-02  9:01     ` Brian Norris
2015-02-02  9:01       ` Brian Norris
2015-02-02  9:01     ` Ricard Wanderlof
2015-02-02  9:01       ` Ricard Wanderlof
2015-02-02  9:20       ` Brian Norris
2015-02-02  9:20         ` Brian Norris
2015-02-08  6:59 ` Brian Norris
2015-02-08  6:59   ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54CF2261.1040707@flawful.org \
    --to=nks@flawful.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.