summaryrefslogtreecommitdiff
path: root/sound/hda/hdac_sysfs.c
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>2019-05-13 12:18:01 +0300
committerTakashi Iwai <tiwai@suse.de>2019-05-13 15:41:56 +0300
commited180abba7f1fc3cf04ffa27767b1bcc8e8c842a (patch)
tree5e740e02d4fd92f1721d12ef0a7b0012d76b54a8 /sound/hda/hdac_sysfs.c
parent891afcf2462d2cc4ef7caf94215358ca61fa32cb (diff)
downloadlinux-ed180abba7f1fc3cf04ffa27767b1bcc8e8c842a.tar.xz
ALSA: hda: Fix race between creating and refreshing sysfs entries
hda_widget_sysfs_reinit() can free underlying codec->widgets structure on which widget_tree_create() operates. Add locking to prevent such issues from happening. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110382 Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda/hdac_sysfs.c')
-rw-r--r--sound/hda/hdac_sysfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/hda/hdac_sysfs.c b/sound/hda/hdac_sysfs.c
index fb2aa344981e..909d5ef1179c 100644
--- a/sound/hda/hdac_sysfs.c
+++ b/sound/hda/hdac_sysfs.c
@@ -395,6 +395,7 @@ static int widget_tree_create(struct hdac_device *codec)
return 0;
}
+/* call with codec->widget_lock held */
int hda_widget_sysfs_init(struct hdac_device *codec)
{
int err;
@@ -411,11 +412,13 @@ int hda_widget_sysfs_init(struct hdac_device *codec)
return 0;
}
+/* call with codec->widget_lock held */
void hda_widget_sysfs_exit(struct hdac_device *codec)
{
widget_tree_free(codec);
}
+/* call with codec->widget_lock held */
int hda_widget_sysfs_reinit(struct hdac_device *codec,
hda_nid_t start_nid, int num_nodes)
{