From: "Adam J. Richter" <adam@yggdrasil.com>
To: linux-kernel@vger.kernel.org, torvalds@transmeta.com,
alan.cox@linux.org, zab@zabbo.net
Subject: PATCH: linux-2.4.10-pre14/drivers/sound/maestro.c ignored pci_module_init results
Date: Sat, 22 Sep 2001 23:02:37 -0700 [thread overview]
Message-ID: <20010922230237.A10872@baldur.yggdrasil.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]
The initialization routine in
linux-2.4.10-pre14/drivers/sound/maestro.c ignores the return value
from pci_module_init, and allows module initialization to succeed
even if pci_module_init failed. pci_module_init fails and unloads
the driver if the caller is a module and there is no matching hardware.
Because maestro.c ignored this failure, loading maestro.o on a system
where the corresponding alsa driver was already loaded or on a system
without matchin hardware would result in a kernel null pointer dereference
in pci_unregister_driver when the module is unloaded or when one
attempts to reboot the system (i.e., when the module attempt to
unregister a PCI driver that is not registered).
This bug is also present in drivers/net/tlan.c and
drivers/net/irda/toshoboe.c. I will send patches for them shortly.
Here is the patch for maestro.c. Please apply.
--
Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."
[-- Attachment #2: maestro.diff --]
[-- Type: text/plain, Size: 477 bytes --]
--- linux-2.4.10-pre14/drivers/sound/maestro.c Sun Aug 12 10:51:42 2001
+++ linux/drivers/sound/maestro.c Sat Sep 22 22:42:48 2001
@@ -3602,7 +3602,12 @@
int __init init_maestro(void)
{
- pci_module_init(&maestro_pci_driver);
+ int rc;
+
+ rc = pci_module_init(&maestro_pci_driver);
+ if (rc < 0)
+ return rc;
+
if (register_reboot_notifier(&maestro_nb))
printk(KERN_WARNING "maestro: reboot notifier registration failed; may not reboot properly.\n");
#ifdef MODULE
next reply other threads:[~2001-09-23 6:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-23 6:02 Adam J. Richter [this message]
2001-09-23 16:24 ` Marcus Meissner
2001-09-23 21:21 Adam J. Richter
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=20010922230237.A10872@baldur.yggdrasil.com \
--to=adam@yggdrasil.com \
--cc=alan.cox@linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=zab@zabbo.net \
/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®