NetBSD-Bugs archive

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

kern/54662: uaudio sometimes not recognized



>Number:         54662
>Category:       kern
>Synopsis:       uaudio sometimes not recognized
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 30 06:35:00 +0000 2019
>Originator:     sc.dying%gmail.com@localhost
>Release:        NetBSD/evbarm 9.99.17
>Organization:
>Environment:
System: NetBSD  9.99.17 NetBSD 9.99.17 (GENERIC) #0: Sun Oct 27 15:43:46 UTC 2019  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC evbarm
Architecture: earmv7hf
Machine: evbarm
Boardtype: Raspberry Pi 3 Model B Rev 1.2
>Description:

 The kernel sometimes fails to attach uaudio(4).

[   5.9522585] audio0: audio_hw_probe failed, error = 6
[   5.9522585] audio0: disabled

At attaching, uaudio(4) kmem_alloc's sc->sc_formats[] in uaudio_identify_as(),
but does not memset(0) them.
One of uninitialized value sc_formats[0].priority is 0xaaaaaaaa in my case,
so audio_hw_probe_fmt() fails with ENXIO.

>How-To-Repeat:


>Fix:

memset(0), or use kmem_zalloc to allocate sc->sc_formats, please.

--- src/sys/dev/usb/uaudio.c.orig	2019-06-06 14:28:12.919115132 +0000
+++ src/sys/dev/usb/uaudio.c	2019-10-29 14:27:39.826567634 +0000
@@ -1795,7 +1795,7 @@ uaudio_identify_as(struct uaudio_softc *
 	}
 
 	/* build audio_format array */
-	sc->sc_formats = kmem_alloc(sizeof(struct audio_format) * sc->sc_nalts,
+	sc->sc_formats = kmem_zalloc(sizeof(struct audio_format) * sc->sc_nalts,
 	    KM_SLEEP);
 	sc->sc_nformats = sc->sc_nalts;
 	for (i = 0; i < sc->sc_nalts; i++) {



Home | Main Index | Thread Index | Old Index