[alsa-devel] [PATCH 34/38] ALSA: hda/realtek - Fix possible Oops with NULL input_mux

Takashi Iwai tiwai at suse.de
Fri Feb 24 17:36:27 CET 2012


When BIOS is damn crazy and gives no pin-config at all, the driver might
lead to a NULL dereference.  Let's add a NULL check for such a case.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/pci/hda/patch_realtek.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index eba50df..997cc81 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -302,6 +302,9 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
 	int i, type, num_conns;
 	hda_nid_t nid;
 
+	if (!spec->input_mux)
+		return 0;
+
 	mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
 	imux = &spec->input_mux[mux_idx];
 	if (!imux->num_items && mux_idx > 0)
-- 
1.7.9



More information about the Alsa-devel mailing list