Module Name: src
Committed By: kardel
Date: Thu Jan 5 09:57:39 UTC 2023
Modified Files:
src/sys/dev/hdaudio: hdafg.c
Log Message:
ignore NULL for hdaudio_audiodev in hdafg_freem
also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/hdaudio/hdafg.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.28 src/sys/dev/hdaudio/hdafg.c:1.29
--- src/sys/dev/hdaudio/hdafg.c:1.28 Tue May 24 06:28:00 2022
+++ src/sys/dev/hdaudio/hdafg.c Thu Jan 5 09:57:39 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.28 2022/05/24 06:28:00 andvar Exp $ */
+/* $NetBSD: hdafg.c,v 1.29 2023/01/05 09:57:39 kardel Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <[email protected]>
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.28 2022/05/24 06:28:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.29 2023/01/05 09:57:39 kardel Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -4226,9 +4226,12 @@ hdafg_freem(void *opaque, void *addr, si
struct hdaudio_audiodev *ad = opaque;
struct hdaudio_stream *st;
- if (addr == DMA_KERNADDR(&ad->ad_playback->st_data))
+ if (ad == NULL)
+ return;
+
+ if (ad->ad_playback != NULL && addr == DMA_KERNADDR(&ad->ad_playback->st_data))
st = ad->ad_playback;
- else if (addr == DMA_KERNADDR(&ad->ad_capture->st_data))
+ else if (ad->ad_capture != NULL && addr == DMA_KERNADDR(&ad->ad_capture->st_data))
st = ad->ad_capture;
else
return;