* [BUG] ALSA: core: seq: a possible double-lock bug in snd_seq_midisynth_remove()
@ 2019-07-29 3:54 Jia-Ju Bai
2019-07-29 5:49 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2019-07-29 3:54 UTC (permalink / raw)
To: perex, Takashi Iwai, gregkh, rfontana, allison, tglx
Cc: alsa-devel, linux-kernel
In snd_seq_midisynth_remove(), there is a possible double-lock bug:
snd_seq_midisynth_remove()
mutex_lock(®ister_mutex); -- line 421
snd_seq_delete_kernel_client() --- line 436
seq_free_client() -- line 2244
mutex_lock(®ister_mutex); -- line 294
This bug is found by a static analysis tool STCheck written by us.
I do not know how to correctly fix this bug, so I only report it.
A possible fix is to release the mutex lock before calling
seq_free_client() in snd_seq_delete_kernel_client() and then acquiring
the lock again after calling seq_free_client().
Best wishes,
Jia-Ju Bai
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] ALSA: core: seq: a possible double-lock bug in snd_seq_midisynth_remove()
2019-07-29 3:54 [BUG] ALSA: core: seq: a possible double-lock bug in snd_seq_midisynth_remove() Jia-Ju Bai
@ 2019-07-29 5:49 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2019-07-29 5:49 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: perex, gregkh, rfontana, allison, tglx, alsa-devel, linux-kernel
On Mon, 29 Jul 2019 05:54:07 +0200,
Jia-Ju Bai wrote:
>
> In snd_seq_midisynth_remove(), there is a possible double-lock bug:
> snd_seq_midisynth_remove()
> mutex_lock(®ister_mutex); -- line 421
> snd_seq_delete_kernel_client() --- line 436
> seq_free_client() -- line 2244
> mutex_lock(®ister_mutex); -- line 294
>
> This bug is found by a static analysis tool STCheck written by us.
No, it's a false-positive report. Both register_mutex's are
static, hence they are local to each file. That is, you're looking at
two different mutexes.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-29 5:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 3:54 [BUG] ALSA: core: seq: a possible double-lock bug in snd_seq_midisynth_remove() Jia-Ju Bai
2019-07-29 5:49 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).