--------------2FE34A2972CA
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
On fr.comp.os.linux.moderated, Herve Dreau (hdreau@worldnet.fr) has
posted an oops with sound modules. I have reproduced it on my 2.1.115.
If you load the sb module, and give a bad irq, sb say the irq is not
valid, but there is no error. The problem is when you do rmmod, the have
the oops: NULL pointer dereference. example :
root@local$insmod sb io=220 irq=1 dma=3
-> SB 2.0 detected OK (220)
-> SB: Can't allocate IRQ1
root@local$
Now, try to do rmmod, and you have the oops.
I have tried to do a patch for this, and I post it as an attachement. I
am new to the kernel, so I do not know if the format is really good, for
the patch. I hope this can help...
Yves yrougy@iname.com
--------------2FE34A2972CA
Content-Type: text/plain; charset=us-ascii; name="patch-yr"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="patch-yr"
diff -u --recursive linux-2.1.115.orig/drivers/sound/sb.h linux/drivers/sound/sb.h
--- linux-2.1.115.orig/drivers/sound/sb.h Thu May 14 19:33:17 1998
+++ linux/drivers/sound/sb.h Sun Aug 16 19:55:53 1998
@@ -121,7 +121,7 @@
void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value);
unsigned int sb_getmixer (sb_devc *devc, unsigned int port);
int sb_dsp_detect (struct address_info *hw_config);
-void sb_dsp_init (struct address_info *hw_config);
+int sb_dsp_init (struct address_info *hw_config);
void sb_dsp_unload(struct address_info *hw_config);
int sb_mixer_init(sb_devc *devc);
void sb_mixer_set_stereo (sb_devc *devc, int mode);
diff -u --recursive linux-2.1.115.orig/drivers/sound/sb_card.c linux/drivers/sound/sb_card.c
--- linux-2.1.115.orig/drivers/sound/sb_card.c Thu May 14 19:33:17 1998
+++ linux/drivers/sound/sb_card.c Sun Aug 16 20:36:12 1998
@@ -22,11 +22,14 @@
#include "sb_mixer.h"
#include "sb.h"
-void attach_sb_card(struct address_info *hw_config)
+int attach_sb_card(struct address_info *hw_config)
{
+int retour=0;
#if defined(CONFIG_AUDIO) || defined(CONFIG_MIDI)
- sb_dsp_init(hw_config);
+ retour=sb_dsp_init(hw_config);
+ return retour;
#endif
+return 0;
}
int probe_sb(struct address_info *hw_config)
@@ -103,7 +106,8 @@
if (!probe_sb(&config))
return -ENODEV;
- attach_sb_card(&config);
+ if (attach_sb_card(&config)<0)
+ return -EINVAL;
#ifdef CONFIG_MIDI
config_mpu.io_base = mpu_io;
if (mpu_io && probe_sbmpu(&config_mpu))
diff -u --recursive linux-2.1.115.orig/drivers/sound/sb_common.c linux/drivers/sound/sb_common.c
--- linux-2.1.115.orig/drivers/sound/sb_common.c Sun Aug 16 21:10:11 1998
+++ linux/drivers/sound/sb_common.c Sun Aug 16 19:46:04 1998
@@ -694,7 +694,7 @@
return 1;
}
-void sb_dsp_init(struct address_info *hw_config)
+int sb_dsp_init(struct address_info *hw_config)
{
sb_devc *devc;
char name[100];
@@ -710,7 +710,7 @@
if (detected_devc == NULL)
{
MDB(printk("No detected device\n"));
- return;
+ return -1;
}
devc = detected_devc;
detected_devc = NULL;
@@ -718,7 +718,7 @@
if (devc->base != hw_config->io_base)
{
DDB(printk("I/O port mismatch\n"));
- return;
+ return -1;
}
/*
* Now continue initialization of the device
@@ -731,7 +731,7 @@
if (request_irq(hw_config->irq, sbintr, 0, "soundblaster", devc) < 0)
{
printk(KERN_ERR "SB: Can't allocate IRQ%d\n", hw_config->irq);
- return;
+ return -1;
}
devc->irq_ok = 0;
@@ -739,7 +739,7 @@
if (!sb16_set_irq_hw(devc, devc->irq)) /* Unsupported IRQ */
{
free_irq(devc->irq, devc);
- return;
+ return -1;
}
if ((devc->type == 0 || devc->type == MDL_ESS) &&
devc->major == 3 && devc->minor == 1)
@@ -916,7 +916,8 @@
else
{
MDB(printk("Sound Blaster: no audio devices found.\n"));
- }
+ };
+ return 0;
}
void sb_dsp_disable_midi(int io_base)
diff -u --recursive linux-2.1.115.orig/drivers/sound/sound_calls.h linux/drivers/sound/sound_calls.h
--- linux-2.1.115.orig/drivers/sound/sound_calls.h Sun Aug 16 21:10:30 1998
+++ linux/drivers/sound/sound_calls.h Sun Aug 16 19:39:55 1998
@@ -92,7 +92,7 @@
int opl3_init(int ioaddr, int *osp);
/* From sb_card.c */
-void attach_sb_card(struct address_info *hw_config);
+int attach_sb_card(struct address_info *hw_config);
int probe_sb(struct address_info *hw_config);
/* From sb_common.c */
--------------2FE34A2972CA--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html