diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-10 18:21:56 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-12 08:44:45 +0100 |
commit | 09b70e8509862debff5a033052f8adbd7402fa4e (patch) | |
tree | 6e67702a50a9433b198cf2d7358be3dca39fe740 /sound/pci/hda/hda_codec.c | |
parent | 08fb0d0ee1b9c7aef79f54a9ae24470621eb6447 (diff) | |
download | blackbird-op-linux-09b70e8509862debff5a033052f8adbd7402fa4e.tar.gz blackbird-op-linux-09b70e8509862debff5a033052f8adbd7402fa4e.zip |
ALSA: hda - Protect user-defined arrays via mutex
The pincfgs, init_verbs and hints set by sysfs or patch might be
changed dynamically on the fly, thus we need to protect it.
Add a simple protection via a mutex.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0a531f2f9255..b28e4031b8a1 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1086,9 +1086,16 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) struct hda_pincfg *pin; #ifdef CONFIG_SND_HDA_HWDEP - pin = look_up_pincfg(codec, &codec->user_pins, nid); - if (pin) - return pin->cfg; + { + unsigned int cfg = 0; + mutex_lock(&codec->user_mutex); + pin = look_up_pincfg(codec, &codec->user_pins, nid); + if (pin) + cfg = pin->cfg; + mutex_unlock(&codec->user_mutex); + if (cfg) + return cfg; + } #endif pin = look_up_pincfg(codec, &codec->driver_pins, nid); if (pin) |