NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/38242: unitialized struct device referencing in opl driver



>Number:         38242
>Category:       kern
>Synopsis:       unitialized struct device referencing in opl driver
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 15 22:00:00 +0000 2008
>Originator:     Onno van der Linden
>Release:        4.9.55
>Organization:
>Environment:
NetBSD sheep 4.99.55 NetBSD 4.99.55 (SHEEP.acpi) #4: Sat Mar 15 20:20:36 MET 
2008  root@sheep:/usr/src/sys/arch/i386/compile/SHEEP.acpi i386

>Description:
Booting a kernel that has the opl driver in it will fail with a uvm_fault 
because it references an unitialized part of its softc structure in
opl_attach(). The unitialized part is sc->mididev.dev.


>How-To-Repeat:
Compile a kernel that uses opl(4) and boot it.
>Fix:
$ diff -c `pwd`/midisyn.c.orig `pwd`/midisyn.c
*** /sys/dev/midisyn.c.orig     Sat Mar 15 22:16:46 2008
--- /sys/dev/midisyn.c  Sat Mar 15 22:17:58 2008
***************
*** 249,255 ****
                .cookie = ms,
                .notify = midisyn_notify
        };
! 
        sc->hw_if = &midisyn_hw_if;
        sc->hw_hdl = ms;
        DPRINTF(("midisyn_attach: ms=%p\n", sc->hw_hdl));
--- 249,255 ----
                .cookie = ms,
                .notify = midisyn_notify
        };
!       sc->dev = (struct device *) sc;
        sc->hw_if = &midisyn_hw_if;
        sc->hw_hdl = ms;
        DPRINTF(("midisyn_attach: ms=%p\n", sc->hw_hdl));



Home | Main Index | Thread Index | Old Index