diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-07-19 11:55:05 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-07-19 16:47:00 +0300 |
commit | 0e279dcea0ec897af1c979ebee4ec92b461793f5 (patch) | |
tree | 404599ef22d243be51004f7252fc6188aa22f70c /sound/usb | |
parent | 70256b42caaf3e13c2932c2be7903a73fbe8bb8b (diff) | |
download | linux-0e279dcea0ec897af1c979ebee4ec92b461793f5.tar.xz |
ALSA: pcm: Fix refcount_inc() on zero usage
The recent rewrite of PCM link lock management introduced the refcount
in snd_pcm_group object, managed by the kernel refcount_t API. This
caused unexpected kernel warnings when the kernel is built with
CONFIG_REFCOUNT_FULL=y. As the warning line indicates, the problem is
obviously that we start with refcount=0 and do refcount_inc() for
adding each PCM link, while refcount_t API doesn't like refcount_inc()
performed on zero.
For adapting the proper refcount_t usage, this patch changes the logic
slightly:
- The initial refcount is 1, assuming the single list entry
- The refcount is incremented / decremented at each PCM link addition
and deletion
- ... which allows us concentrating only on the refcount as a release
condition
Fixes: f57f3df03a8e ("ALSA: pcm: More fine-grained PCM link locking")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204221
Reported-and-tested-by: Duncan Overbruck <kernel@duncano.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
0 files changed, 0 insertions, 0 deletions