* [bug report] potential deadlock in snd_emu10k1_voice_alloc()
@ 2021-02-02 5:56 Dan Carpenter
2021-02-02 8:18 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-02-02 5:56 UTC (permalink / raw)
To: alsa-devel
Hello ALSA devs,
The patch 1da177e4c3f4: "Linux-2.6.12-rc2" from Apr 16, 2005, leads
to the following static checker warning:
sound/pci/emu10k1/voice.c:112 snd_emu10k1_voice_alloc()
warn: called with lock held. '&emu->voice_lock'
sound/pci/emu10k1/voice.c
101 int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number,
102 struct snd_emu10k1_voice **rvoice)
103 {
104 unsigned long flags;
105 int result;
106
107 if (snd_BUG_ON(!rvoice))
108 return -EINVAL;
109 if (snd_BUG_ON(!number))
110 return -EINVAL;
111
112 spin_lock_irqsave(&emu->voice_lock, flags);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This lock is already held in the caller.
113 for (;;) {
114 result = voice_alloc(emu, type, number, rvoice);
115 if (result == 0 || type == EMU10K1_SYNTH || type == EMU10K1_MIDI)
116 break;
117
118 /* free a voice from synth */
119 if (emu->get_synth_voice) {
The call tree is:
snd_emux_note_on()
takes the lock: spin_lock_irqsave(&emu->voice_lock, flags);
calls vp = emu->ops.get_voice(emu, port);
--> get_voice()
--> snd_emu10k1_voice_alloc()
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] potential deadlock in snd_emu10k1_voice_alloc()
2021-02-02 5:56 [bug report] potential deadlock in snd_emu10k1_voice_alloc() Dan Carpenter
@ 2021-02-02 8:18 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-02-02 8:18 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel
On Tue, 02 Feb 2021 06:56:08 +0100,
Dan Carpenter wrote:
>
> Hello ALSA devs,
>
> The patch 1da177e4c3f4: "Linux-2.6.12-rc2" from Apr 16, 2005, leads
> to the following static checker warning:
>
> sound/pci/emu10k1/voice.c:112 snd_emu10k1_voice_alloc()
> warn: called with lock held. '&emu->voice_lock'
>
> sound/pci/emu10k1/voice.c
> 101 int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int number,
> 102 struct snd_emu10k1_voice **rvoice)
> 103 {
> 104 unsigned long flags;
> 105 int result;
> 106
> 107 if (snd_BUG_ON(!rvoice))
> 108 return -EINVAL;
> 109 if (snd_BUG_ON(!number))
> 110 return -EINVAL;
> 111
> 112 spin_lock_irqsave(&emu->voice_lock, flags);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This lock is already held in the caller.
>
> 113 for (;;) {
> 114 result = voice_alloc(emu, type, number, rvoice);
> 115 if (result == 0 || type == EMU10K1_SYNTH || type == EMU10K1_MIDI)
> 116 break;
> 117
> 118 /* free a voice from synth */
> 119 if (emu->get_synth_voice) {
>
> The call tree is:
>
> snd_emux_note_on()
> takes the lock: spin_lock_irqsave(&emu->voice_lock, flags);
> calls vp = emu->ops.get_voice(emu, port);
> --> get_voice()
> --> snd_emu10k1_voice_alloc()
This report looks like a false-positive, too.
Both are from different structs, one is from struct snd_emu10k1 and
another is struct snd_emux.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-02 8:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 5:56 [bug report] potential deadlock in snd_emu10k1_voice_alloc() Dan Carpenter
2021-02-02 8:18 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.