From: "Oskar Schirmer" <oskar@scara.com>
To: "Jaroslav Kysela" <perex@perex.cz>
Cc: linux-kernel@vger.kernel.org, "Takashi Iwai" <tiwai@suse.de>,
alsa-devel@alsa-project.org,
"Andrew Morton" <akpm@linux-foundation.org>,
"Oskar Schirmer" <oskar@scara.com>
Subject: [PATCH] ALSA: pcm: retrieve true appl_ptr where stream was unlocked
Date: 12 Nov 2013 16:14:17 +0000 [thread overview]
Message-ID: <1384272857-24473-1-git-send-email-oskar@scara.com> (raw)
Calculated for data transfer, the local variable appl_ptr is reused,
changed and written back later, though the lock was not held during
the transfer earlier. Admitted, destiny of the lock is not obvious
at all, but this looks much like a race condition candidate, so make
sure to have some original appl_ptr value to work on.
Two occurences.
Signed-off-by: Oskar Schirmer <oskar@scara.com>
---
sound/core/pcm_lib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 6e03b46..47e836a 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -2051,6 +2051,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream,
default:
break;
}
+ appl_ptr = runtime->control->appl_ptr;
appl_ptr += frames;
if (appl_ptr >= runtime->boundary)
appl_ptr -= runtime->boundary;
@@ -2283,6 +2284,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream,
default:
break;
}
+ appl_ptr = runtime->control->appl_ptr;
appl_ptr += frames;
if (appl_ptr >= runtime->boundary)
appl_ptr -= runtime->boundary;
--
1.7.9.5
next reply other threads:[~2013-11-12 16:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 16:14 Oskar Schirmer [this message]
2013-11-12 16:29 ` 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=1384272857-24473-1-git-send-email-oskar@scara.com \
--to=oskar@scara.com \
--cc=akpm@linux-foundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/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®