PATCH: fix for soundblaster module oops at rmmod time (fwd)

From: Matthias Hanisch (matze@camline.com)
Date: Fri Sep 21 2001 - 03:16:25 EST


[ I sent this to linux-sound yesterday. Nerijus Baliunas
  <nerijus@users.sourceforge.net> asked me to forward this also to
  linux-kernel. So here it is.
]

Hi!

Soundblaster module in version 2.4.10-pre12 and many (pre-)patches before
oopsed in sb_dsp_unload at the module deletion phase.

Loading the module reports

Sep 17 23:08:05 pingu kernel: <Sound Blaster (8 BIT/MONO ONLY) (2.01)> at
0x220 irq 5 dma 1>

so sb_mixer_init() is not called, because devc->major == 2.

Problem is that at "module deletion time", the call to sb_mixer_unload()
is unconditional and a

        kfree(mixer_devs[devc->my_mixerdev]);

is not very healthy if devc->my_mixerdev == -1 (the initial value).

This kfree() call without checking the array index got introduced in
2.4.8, sound_unload_mixerdev() which is called after kfree() contains a
check for devc->my_mixerdev != -1.

The attached patch cures this, it just introduces this check. It should
apply to any recent kernel.

Regards,

        Matze

-- 
Matthias Hanisch    mailto:matze@camline.com    phone: +49 8137 935-219


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 23 2001 - 21:00:42 EST