From: Corey Minyard <minyard@acm.org>
To: Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Torvalds <torvalds@linux-foundation.org>
Cc: stable@kernel.org, openipmi-developer@lists.sourceforge.net,
Peter Huewe <peterhuewe@gmx.de>,
Randy Dunlap <randy.dunlap@oracle.com>
Subject: [PATCH] char/ipmi: fix OOPS caused by pnp_unregister_driver on unregistered driver
Date: Thu, 10 Feb 2011 16:08:38 -0600 [thread overview]
Message-ID: <20110210220838.GA25539@mail.minyard.local> (raw)
This patch fixes an OOPS triggered when calling modprobe ipmi_si a
second time after the first modprobe returned without finding any ipmi
devices. This can happen if you reload the module after having the
first module load fail. The driver was not deregistering from
PNP in that case.
Peter Huewe originally reported this patch and supplied a fix, I have
a different patch based on Linus' suggestion that cleans things up a
bit more.
KernelVersion: 2.6.37
Cc: <stable@kernel.org>
Cc: <openipmi-developer@lists.sourceforge.net>
Cc: Peter Huewe <peterhuewe@gmx.de>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
drivers/char/ipmi/ipmi_si_intf.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index b6ae6e9..7855f9f 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -320,6 +320,7 @@ static int unload_when_empty = 1;
static int add_smi(struct smi_info *smi);
static int try_smi_init(struct smi_info *smi);
static void cleanup_one_si(struct smi_info *to_clean);
+static void cleanup_ipmi_si(void);
static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list);
static int register_xaction_notifier(struct notifier_block *nb)
@@ -3450,16 +3451,7 @@ static int __devinit init_ipmi_si(void)
mutex_lock(&smi_infos_lock);
if (unload_when_empty && list_empty(&smi_infos)) {
mutex_unlock(&smi_infos_lock);
-#ifdef CONFIG_PCI
- if (pci_registered)
- pci_unregister_driver(&ipmi_pci_driver);
-#endif
-
-#ifdef CONFIG_PPC_OF
- if (of_registered)
- of_unregister_platform_driver(&ipmi_of_platform_driver);
-#endif
- driver_unregister(&ipmi_driver.driver);
+ cleanup_ipmi_si();
printk(KERN_WARNING PFX
"Unable to find any System Interface(s)\n");
return -ENODEV;
--
1.6.3.3.333.gdf68
next reply other threads:[~2011-02-10 22:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-10 22:08 Corey Minyard [this message]
2011-02-10 22:40 ` [PATCH] char/ipmi: fix OOPS caused by pnp_unregister_driver on unregistered driver Peter Hüwe
-- strict thread matches above, loose matches on Subject: below --
2011-01-09 15:41 Peter Huewe
2011-01-18 21:50 ` Peter Hüwe
2011-01-30 19:14 ` Peter Hüwe
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=20110210220838.GA25539@mail.minyard.local \
--to=minyard@acm.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=peterhuewe@gmx.de \
--cc=randy.dunlap@oracle.com \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox