All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [bug report] potential deadlock in snd_emu10k1_voice_alloc()
Date: Tue, 02 Feb 2021 09:18:50 +0100	[thread overview]
Message-ID: <s5htuqug9w5.wl-tiwai@suse.de> (raw)
In-Reply-To: <YBjpeGqqiEYLaNyx@mwanda>

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

      reply	other threads:[~2021-02-02  8:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  5:56 [bug report] potential deadlock in snd_emu10k1_voice_alloc() Dan Carpenter
2021-02-02  8:18 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5htuqug9w5.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.carpenter@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.