All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: alsa-devel@alsa-project.org
Subject: [bug report] potential deadlock in snd_emu10k1_voice_alloc()
Date: Tue, 2 Feb 2021 08:56:08 +0300	[thread overview]
Message-ID: <YBjpeGqqiEYLaNyx@mwanda> (raw)

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

             reply	other threads:[~2021-02-02  5:59 UTC|newest]

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

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=YBjpeGqqiEYLaNyx@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    /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.