summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-07-19 19:22:05 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-07-19 19:22:05 +0000
commitc8aa7cb6bc28a7f91787678b0b9fca9f5a7684a4 (patch)
tree03345b3246ec6273f7eae8efb040e72cdfebcf78 /sys/dev/pci
parentb81e76e083eb7d11994d9855184d0c10236682fe (diff)
fix crash by reading a mixer value with AD1891HD codec, which
has invalid connection lists. From kent@NetBSD
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/azalia_codec.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c
index ade6007e22d..6e8d1098d51 100644
--- a/sys/dev/pci/azalia_codec.c
+++ b/sys/dev/pci/azalia_codec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia_codec.c,v 1.15 2006/06/25 00:54:16 brad Exp $ */
+/* $OpenBSD: azalia_codec.c,v 1.16 2006/07/19 19:22:04 brad Exp $ */
/* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */
/*-
@@ -883,7 +883,19 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, mixer_ctrl_
return err;
mc->un.value.level[0] = azalia_generic_mixer_from_device_value(this,
nid, target, CORB_GAGM_GAIN(result));
- n = this->w[nid].connections[MI_TARGET_INAMP(target)];
+ if (this->w[nid].type == COP_AWTYPE_AUDIO_SELECTOR ||
+ this->w[nid].type == COP_AWTYPE_AUDIO_MIXER) {
+ n = this->w[nid].connections[MI_TARGET_INAMP(target)];
+#ifdef AZALIA_DEBUG
+ if (!VALID_WIDGET_NID(n, this)) {
+ DPRINTF(("%s: invalid target: nid=%d nconn=%d index=%d\n",
+ __func__, nid, this->w[nid].nconnections,
+ MI_TARGET_INAMP(target)));
+ return EINVAL;
+ }
+#endif
+ } else
+ n = nid;
mc->un.value.num_channels = WIDGET_CHANNELS(&this->w[n]);
if (mc->un.value.num_channels == 2) {
err = this->comresp(this, nid,