diff options
| author | Steven Rostedt (Google) <[email protected]> | 2022-10-27 03:12:36 +0000 |
|---|---|---|
| committer | Takashi Iwai <[email protected]> | 2022-10-27 06:42:08 +0000 |
| commit | f0a868788fcbf63cdab51f5adcf73b271ede8164 (patch) | |
| tree | 49269e38809f1953cb26942cf5cb77c7207d0e4a /tools/lib/api/fs/tracing_path.c | |
| parent | ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev() (diff) | |
| download | kernel-f0a868788fcbf63cdab51f5adcf73b271ede8164.tar.gz kernel-f0a868788fcbf63cdab51f5adcf73b271ede8164.zip | |
ALSA: Use del_timer_sync() before freeing timer
The current code for freeing the emux timer is extremely dangerous:
CPU0 CPU1
---- ----
snd_emux_timer_callback()
snd_emux_free()
spin_lock(&emu->voice_lock)
del_timer(&emu->tlist); <-- returns immediately
spin_unlock(&emu->voice_lock);
[..]
kfree(emu);
spin_lock(&emu->voice_lock);
[BOOM!]
Instead just use del_timer_sync() which will wait for the timer to finish
before continuing. No need to check if the timer is active or not when
doing so.
This doesn't fix the race of a possible re-arming of the timer, but at
least it won't use the data that has just been freed.
[ Fixed unused variable warning by tiwai ]
Cc: [email protected]
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Steven Rostedt (Google) <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Diffstat (limited to 'tools/lib/api/fs/tracing_path.c')
0 files changed, 0 insertions, 0 deletions
