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>
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user