From 4f6be8c788ca0339a84e935515d290b59dbec31b Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 8 Apr 2022 18:31:29 -0700 Subject: [PATCH] bcm2835_audio_callback: Don't process garbage if there is no message. If vchi_msg_dequeue failed due to an empty queue, return rather than treating stack garbage as a valid message. --- sys/arm/broadcom/bcm2835/bcm2835_audio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_audio.c b/sys/arm/broadcom/bcm2835/bcm2835_audio.c index ae2c9a14fc6..da5939ec33c 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_audio.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_audio.c @@ -207,6 +207,8 @@ bcm2835_audio_callback(void *param, const VCHI_CALLBACK_REASON_T reason, void *m status = vchi_msg_dequeue(sc->vchi_handle, &m, sizeof m, &msg_len, VCHI_FLAGS_NONE); + if (status != 0) + return; if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { if (m.u.result.success) { device_printf(sc->dev,