mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Jia-Ju Bai" <baijiaju1990@gmail.com>
Cc: <keescook@chromium.org>, <perex@perex.cz>,
	<alsa-devel@alsa-project.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] sound: pci: trident: a possible data race
Date: Wed, 03 Oct 2018 17:54:10 +0200	[thread overview]
Message-ID: <s5hk1mzowkd.wl-tiwai@suse.de> (raw)
In-Reply-To: <864e211c-8be5-6a34-902a-a71f176111db@gmail.com>

On Wed, 03 Oct 2018 14:50:25 +0200,
Jia-Ju Bai wrote:
> 
> CPU0:
> snd_trident_hw_free
>     snd_trident_free_voice
>             line 3870: spin_lock_irqsave()
>             line 3881: voice->substream = NULL; [WRITE]
> CPU1:
> snd_trident_interrupt
>     line 3798: snd_pcm_period_elapsed(voice->substream);  [READ]
> 
> As for voice->substream, the WRITE operation in CPU0 is performed
> with holding a spinlock, but the READ operation in CPU1 is performed
> without holding this spinlock, so there may exist a data race.

Thanks for the report.

The actual crash must be very unlikely, almost 0%, though.
snd_trident_hw_free() is called always after the PCM stream gets
stopped via trigger callback, i.e. at the moment, there is no
corresponding interrupt is generated for that voice entry.

And the hardware is very old, I bet only a handful people still using
in the whole world :)

If we really want to be 100% sure, we may call synchronize_irq()
before the NULL-clearing.  But there is no way to test the bug nor
the fix, so it's fairly moot, IMO.


thanks,

Takashi

  reply	other threads:[~2018-10-03 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 12:50 Jia-Ju Bai
2018-10-03 15:54 ` Takashi Iwai [this message]
2018-10-04  3:08   ` Jia-Ju Bai
2018-10-04  5:24     ` Takashi Iwai
2018-10-04  9:17       ` Jia-Ju Bai

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=s5hk1mzowkd.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=baijiaju1990@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®