Skip to content

Commit

Permalink
ALSA: hda/realtek - Fix possible Oops with NULL input_mux
Browse files Browse the repository at this point in the history
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@suse.de>
  • Loading branch information
Takashi Iwai committed Feb 21, 2012
1 parent 164f73e commit 5803a32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5803a32

Please sign in to comment.