ALSA: hda - Fix possible race on regmap bypass flip
authorTakashi Iwai <tiwai@suse.de>
Thu, 21 Apr 2016 15:49:11 +0000 (17:49 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 21 Apr 2016 15:59:17 +0000 (17:59 +0200)
commit3194ed497939c6448005542e3ca4fa2386968fa0
tree88df2e9ffc4a4ba6215de034a9cabe4c11bf2428
parent67f3754b51f22b18c4820fb84062f658c30e8644
ALSA: hda - Fix possible race on regmap bypass flip

HD-audio driver uses regmap cache bypass feature for reading a raw
value without the cache.  But this is racy since both the cached and
the uncached reads may occur concurrently.  The former is done via the
normal control API access while the latter comes from the proc file
read.

Even though the regmap itself has the protection against the
concurrent accesses, the flag set/reset is done without the
protection, so it may lead to inconsistent state of bypass flag that
doesn't match with the current read and occasionally result in a
kernel WARNING like:
  WARNING: CPU: 3 PID: 2731 at drivers/base/regmap/regcache.c:499 regcache_cache_only+0x78/0x93

One way to work around such a problem is to wrap with a mutex.  But in
this case, the solution is simpler: for the uncached read, we just
skip the regmap and directly calls its accessor.  The verb execution
there is protected by itself, so basically it's safe to call
individually.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116171
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/hda_regmap.h
sound/hda/hdac_device.c
sound/hda/hdac_regmap.c
This page took 0.026308 seconds and 5 git commands to generate.