All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Edward Adam Davis <eadavis@qq.com>
Cc: syzbot+18840ef96e57b83b7fea@syzkaller.appspotmail.com,
	linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
	perex@perex.cz, syzkaller-bugs@googlegroups.com, tiwai@suse.com
Subject: Re: [PATCH] ALSA: timer: fix deadlock in _snd_pcm_stream_lock_irqsave
Date: Thu, 21 Mar 2024 07:33:03 +0100	[thread overview]
Message-ID: <87y1acrt5s.wl-tiwai@suse.de> (raw)
In-Reply-To: <tencent_AC7946DBB367A364897F43B2045A37625705@qq.com>

On Thu, 21 Mar 2024 03:22:24 +0100,
Edward Adam Davis wrote:
> 
> [Syzbot reported]
> swapper/2/0 just changed the state of lock:
> ffff88802a304110 (&group->lock#2){..-.}-{2:2}, at: _snd_pcm_stream_lock_irqsave+0xa0/0xd0 sound/core/pcm_native.c:170
> but this lock took another, SOFTIRQ-unsafe lock in the past:
>  (&timer->lock){+.+.}-{2:2}
> 
> 
> and interrupts could create inverse lock ordering between them.
> 
> 
> other info that might help us debug this:
>  Possible interrupt unsafe locking scenario:
> 
>        CPU0                    CPU1
>        ----                    ----
>   lock(&timer->lock);
>                                local_irq_disable();
>                                lock(&group->lock#2);
>                                lock(&timer->lock);
>   <Interrupt>
>     lock(&group->lock#2);
> 
>  *** DEADLOCK ***
> [Fix]
> Ensure that the context interrupt state is the same before and after using the
> timer->lock.
> 
> Fixes: beb45974dd49 ("ALSA: timer: Use guard() for locking")
> Reported-and-tested-by: syzbot+18840ef96e57b83b7fea@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>

This was already fixed in Linus tree commit
587d67fd929ad89801bcc429675bda90d53f6592.


thanks,

Takashi

      reply	other threads:[~2024-03-21  6:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 19:59 [syzbot] [sound?] possible deadlock in _snd_pcm_stream_lock_irqsave (4) syzbot
2024-03-19  6:40 ` Takashi Iwai
2024-03-21  0:40 ` Edward Adam Davis
2024-03-21  0:42   ` syzbot
2024-03-21  1:30 ` Edward Adam Davis
2024-03-21  1:54   ` syzbot
2024-03-21  2:22 ` [PATCH] ALSA: timer: fix deadlock in _snd_pcm_stream_lock_irqsave Edward Adam Davis
2024-03-21  6:33   ` 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=87y1acrt5s.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=syzbot+18840ef96e57b83b7fea@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tiwai@suse.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.