From: Francois Romieu <romieu@fr.zoreil.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Bug in BCMA: device_unregister causing "NULL pointer dereference at"
Date: Thu, 14 Jul 2011 16:45:09 +0200 [thread overview]
Message-ID: <20110714144509.GA6391@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <CACna6rxAKMp-2wqwz4k4S3nTkY_3Qz7=hEZk9F2Zig7T5kp_HA@mail.gmail.com>
Rafał Miłecki <zajec5@gmail.com> :
[...]
> Any tip, why does it happen?
bcma_release_core_dev kfrees core while its list_head is still used ?
May be something like this :
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index be52344..85fb3aa 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -110,11 +110,14 @@ static int bcma_register_cores(struct bcma_bus *bus)
static void bcma_unregister_cores(struct bcma_bus *bus)
{
- struct bcma_device *core;
+ struct bcma_device *core, *next;
- list_for_each_entry(core, &bus->cores, list) {
+ list_for_each_entry_safe(core, next, &bus->cores, list) {
+ list_del(&core->list);
if (core->dev_registered)
device_unregister(&core->dev);
+ else
+ kfree(core);
}
}
next prev parent reply other threads:[~2011-07-14 14:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-07 15:25 Rafał Miłecki
2011-07-07 15:27 ` Rafał Miłecki
2011-07-14 14:45 ` Francois Romieu [this message]
2011-07-21 7:14 ` Rafał Miłecki
2011-07-21 7:18 ` Rafał Miłecki
2011-07-21 16:33 ` Pavel Roskin
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=20110714144509.GA6391@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=zajec5@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®