Unbreak slot_irq_handler(). The problem here is that slot_irq_handler()

abuses its argument, which is supposed to be an integer unit number, as
a pointer to the head of the 'struct slot' list. When this code was
hacked^Wupdated for newbus, a new mechanism for registering slot_irq_handler()
was put in place and the significance of the unit number was overlooked.
When registering an interrupt, we have both device_id and unit. The unit
number is passed as 'unit' but /sys/i386/usa/intr_machdep.c:register_intr()
drops unit on the floor and uses device_id instead. Since pccard_alloc_intr()
always sets device_id to 0, this means the unit number is always zero, and
slot_irq_handler() is always called with 0, which becomes a NULL pointer
which slot_irq_handler() tries to dereference and the kernel explodes.

Result: if you assign a PCMCIA driver in the kernel config file like this:

device wi0 at isa? port? irq?

Then the system will panic the moment a PCMCIA device is attached and
an interrupt is triggered.

The quick fix: make pccard_alloc_intr() pass the unit number as both
the device_id and unit arguments to register_pcic_intr(). The correct fix
would be to rewrite /sys/pccard to be less disgusting.
This commit is contained in:
Bill Paul 1999-05-04 15:43:02 +00:00
parent 7245fe241c
commit 134a826b50
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46417

View File

@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pccard.c,v 1.76 1999/04/27 18:47:39 jdp Exp $
* $Id: pccard.c,v 1.77 1999/05/02 04:19:27 nate Exp $
*/
#include "opt_devfs.h"
@ -526,7 +526,7 @@ pccard_alloc_intr(u_int imask, inthand2_t *hand, int unit,
if (!(mask & imask))
continue;
INTRMASK(*maskp, mask);
if (register_pcic_intr(irq, 0, 0, hand, maskp, unit) == 0) {
if (register_pcic_intr(irq, unit, 0, hand, maskp, unit) == 0) {
/* add this to the PCIC controller's mask */
if (pcic_imask)
INTRMASK(*pcic_imask, (1 << irq));