linux/sound/hda
Takashi Iwai 9780ded39b ALSA: hda: Avoid racy recreation of widget kobjects
The refresh of HD-audio widget sysfs kobjects via
snd_hdac_refresh_widget_sysfs() is slightly racy.
The driver recreates the whole tree from scratch after deleting the
whole.  When CONFIG_DEBUG_KOBJECT_RELEASE option is used, kobject
release doesn't happen immediately but delayed, while the re-creation
of the same named kobject happens soon after invoking kobject_put().
This may end up with the conflicts of duplicated kobjects, as found in
the bug report below.

In this patch, we take another approach to refresh the tree: instead
of recreating the whole tree, just add the new nodes and delete the
non-existing nodes.  Since the refresh happens only once at
initialization, no longer race would happen.

Along with the code change, merge snd_hdac_refresh_widget_sysfs() with
the existing snd_hdac_refresh_widgets() with an additional bool flag
for simplifying the code.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197307
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-10-19 13:58:36 +02:00
..
ext ALSA: hda - add more ML register definitions 2017-04-07 10:39:18 +02:00
Kconfig ALSA: HDAC: move SND_HDA_PREALLOC_SIZE to core 2015-06-16 17:40:38 +02:00
Makefile ALSA: hda - Add hdmi chmap verb programming ops to chmap object 2016-03-07 15:41:31 +01:00
array.c ALSA: hda: Fix krealloc() with __GFP_ZERO usage 2016-08-03 15:17:22 +02:00
hda_bus_type.c ALSA: hda - Advertise MODALIAS in uevent 2015-10-20 10:15:53 +02:00
hdac_bus.c ALSA: hda: Fix potential race at unregistration and unsol events 2017-06-20 07:53:57 +02:00
hdac_controller.c ALSA: hda: Fix cpu lockup when stopping the cmd dmas 2017-05-10 08:47:17 +02:00
hdac_device.c ALSA: hda: Avoid racy recreation of widget kobjects 2017-10-19 13:58:36 +02:00
hdac_i915.c ALSA: hda: constify pci_device_id. 2017-07-18 20:01:21 +02:00
hdac_regmap.c ALSA: hdac_regmap - fix the register access for runtime PM 2016-06-17 14:01:06 +02:00
hdac_stream.c ALSA: hda - Avoid tricky macros 2017-04-03 08:42:43 +02:00
hdac_sysfs.c ALSA: hda: Avoid racy recreation of widget kobjects 2017-10-19 13:58:36 +02:00
hdmi_chmap.c ALSA: hda: fix some klockwork scan warnings 2016-06-16 10:10:12 +02:00
local.h ALSA: hda: Avoid racy recreation of widget kobjects 2017-10-19 13:58:36 +02:00
trace.c ALSA: hda - Re-add tracepoints to HD-audio core driver 2015-03-23 13:17:58 +01:00
trace.h ALSA: hda - add hdac stream trace 2015-05-18 10:06:20 +02:00