git: 4f6be8c788ca - main - bcm2835_audio_callback: Don't process garbage if there is no message.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 09 Apr 2022 01:31:48 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f6be8c788ca0339a84e935515d290b59dbec31b

commit 4f6be8c788ca0339a84e935515d290b59dbec31b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-09 01:31:29 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-09 01:31:29 +0000

    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 ae2c9a14fc62..da5939ec33cb 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,