diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-11-07 20:20:08 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-11-08 14:52:44 +0100 |
commit | 6a34367e52caea1413eb0a0dcbb524f0c9b67e82 (patch) | |
tree | a52eda441990007a9143d0ecc1f286541bd4a075 /include/sound/aess.h | |
parent | 33bbb8a0ecd142fb5e78f26f3a0b927ae77c30e7 (diff) | |
download | linux-stable-6a34367e52caea1413eb0a0dcbb524f0c9b67e82.tar.gz linux-stable-6a34367e52caea1413eb0a0dcbb524f0c9b67e82.tar.bz2 linux-stable-6a34367e52caea1413eb0a0dcbb524f0c9b67e82.zip |
ALSA: timer: Fix possible race at assigning a timer instance
When a new timer instance is created and assigned to the active link
in snd_timer_open(), the caller still doesn't (can't) set its callback
and callback data. In both the user-timer and the sequencer-timer
code, they do manually set up the callbacks after calling
snd_timer_open(). This has a potential risk of race when the timer
instance is added to the already running timer target, as the callback
might get triggered during setting up the callback itself.
This patch tries to address it by changing the API usage slightly:
- An empty timer instance is created at first via the new function
snd_timer_instance_new(). This object isn't linked to the timer
list yet.
- The caller sets up the callbacks and others stuff for the new timer
instance.
- The caller invokes snd_timer_open() with this instance, so that it's
linked to the target timer.
For closing, do similarly:
- Call snd_timer_close(). This unlinks the timer instance from the
timer list.
- Free the timer instance via snd_timer_instance_free() after that.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191107192008.32331-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/aess.h')
0 files changed, 0 insertions, 0 deletions