diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-12-02 09:29:12 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-12-02 09:29:12 -0500 |
commit | cce4aa378a049f4275416ee6302dd24f37b289df (patch) | |
tree | b686554cfc7417299b37152d746f8670ee204551 | |
parent | fc084e0b930d546872ab23667052499f7daf0fed (diff) |
ALSA: hda/realtek - Fix Oops in alc_mux_select()
When no imux is available (e.g. a single capture source),
alc_auto_init_input_src() may trigger an Oops due to the access to -1.
Add a proper zero-check to avoid it.
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cbde019d3d52..a7d1bc4e0d09 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
297 | imux = &spec->input_mux[mux_idx]; | 297 | imux = &spec->input_mux[mux_idx]; |
298 | if (!imux->num_items && mux_idx > 0) | 298 | if (!imux->num_items && mux_idx > 0) |
299 | imux = &spec->input_mux[0]; | 299 | imux = &spec->input_mux[0]; |
300 | if (!imux->num_items) | ||
301 | return 0; | ||
300 | 302 | ||
301 | if (idx >= imux->num_items) | 303 | if (idx >= imux->num_items) |
302 | idx = imux->num_items - 1; | 304 | idx = imux->num_items - 1; |