lkml.org 
[lkml]   [1998]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH sound module removal oops fixed.
Hi Alan.

In 2.1.103 and probably since the late 90s, removing the Soundblaster
module produced a kernel oops. I tracked down unload_uart401() in
uart401.c to be the culprit:

*** from uart401.c ***

sound_unload_mididev(hw_config->slots[4]);
if (devc)
{
kfree(midi_devs[devc->my_dev]->converter);
kfree(midi_devs[devc->my_dev]);
*** end ***

Actually I'm not aware of the difference between hw_config->slots[4] and
devc->my_dev (usually both are 0). However in sound_unload_mididev()
midi_devs[hw_config->slots[4]] is set to NULL, so the following
midi_devs[devc->my_dev]->converter inevitably produces a NULL pointer
dereference oops. The attached patch should fix the problem. I'm not sure
if it's the best way to work around but it certainly works for me. Please
try to get it into 2.1.104 if possible since the oops will leave the
modutils in a rather wrecked state, i.e. kernel autoloading will still
work but any manual modprobe/insmod/rmmod call just fails.

Regards,

Daniel.

--- drivers/sound/uart401.c.orig Mon May 25 23:23:52 1998
+++ drivers/sound/uart401.c Mon May 25 23:16:12 1998
@@ -416,11 +416,12 @@
{
uart401_devc *devc;
int n=hw_config->slots[4];
-
+ struct midi_operations *my_midi_dev;
+
/* Not set up */
if(n==-1 || midi_devs[n]==NULL)
return;
-
+
/* Not allocated (erm ??) */

devc = midi_devs[hw_config->slots[4]]->devc;
@@ -432,11 +433,15 @@

if (!devc->share_irq)
free_irq(devc->irq, devc);
+
+ my_midi_dev = midi_devs[devc->my_dev];
+
sound_unload_mididev(hw_config->slots[4]);
+
if (devc)
{
- kfree(midi_devs[devc->my_dev]->converter);
- kfree(midi_devs[devc->my_dev]);
+ kfree(my_midi_dev->converter);
+ kfree(my_midi_dev);
kfree(devc);
devc = NULL;
}
\
 
 \ /
  Last update: 2005-03-22 13:42    [from the cache]
©2003-2011 Jasper Spaans