Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 2/5] ALSA: pcm: Drop async signal support
Date: Fri, 15 Jul 2022 12:29:32 +0200	[thread overview]
Message-ID: <20220715102935.4695-3-tiwai@suse.de> (raw)
In-Reply-To: <20220715102935.4695-1-tiwai@suse.de>

The async signal (SIGIO) support for ALSA PCM API has been never used
by real applications, but yet it can be a cause of various potential
deadlocks, as spotted by syzkaller.  Let's drop the feature as the
simplest solution.

Reported-by: syzbot+8285e973a41b5aa68902@syzkaller.appspotmail.com
Reported-by: syzbot+669c9abf11a6a011dd09@syzkaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 include/sound/pcm.h     |  1 -
 sound/core/pcm_lib.c    |  4 +---
 sound/core/pcm_native.c | 18 ------------------
 3 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 08cf4a5801f3..9bbd3742ef59 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -399,7 +399,6 @@ struct snd_pcm_runtime {
 	snd_pcm_uframes_t twake; 	/* do transfer (!poll) wakeup if non-zero */
 	wait_queue_head_t sleep;	/* poll sleep */
 	wait_queue_head_t tsleep;	/* transfer sleep */
-	struct fasync_struct *fasync;
 	bool stop_operating;		/* sync_stop will be called */
 	struct mutex buffer_mutex;	/* protect for buffer changes */
 	atomic_t buffer_accessing;	/* >0: in r/w operation, <0: blocked */
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 1fc7c50ffa62..a7b10ee5d57d 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1815,14 +1815,12 @@ void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substrea
 
 	if (!snd_pcm_running(substream) ||
 	    snd_pcm_update_hw_ptr0(substream, 1) < 0)
-		goto _end;
+		return;
 
 #ifdef CONFIG_SND_PCM_TIMER
 	if (substream->timer_running)
 		snd_timer_interrupt(substream->timer, 1);
 #endif
- _end:
-	kill_fasync(&runtime->fasync, SIGIO, POLL_IN);
 }
 EXPORT_SYMBOL(snd_pcm_period_elapsed_under_stream_lock);
 
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index aa0453e51595..c8e340b97277 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3938,22 +3938,6 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
 	return 0;
 }
 
-static int snd_pcm_fasync(int fd, struct file * file, int on)
-{
-	struct snd_pcm_file * pcm_file;
-	struct snd_pcm_substream *substream;
-	struct snd_pcm_runtime *runtime;
-
-	pcm_file = file->private_data;
-	substream = pcm_file->substream;
-	if (PCM_RUNTIME_CHECK(substream))
-		return -ENXIO;
-	runtime = substream->runtime;
-	if (runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED)
-		return -EBADFD;
-	return fasync_helper(fd, file, on, &runtime->fasync);
-}
-
 /*
  * ioctl32 compat
  */
@@ -4118,7 +4102,6 @@ const struct file_operations snd_pcm_f_ops[2] = {
 		.unlocked_ioctl =	snd_pcm_ioctl,
 		.compat_ioctl = 	snd_pcm_ioctl_compat,
 		.mmap =			snd_pcm_mmap,
-		.fasync =		snd_pcm_fasync,
 		.get_unmapped_area =	snd_pcm_get_unmapped_area,
 	},
 	{
@@ -4132,7 +4115,6 @@ const struct file_operations snd_pcm_f_ops[2] = {
 		.unlocked_ioctl =	snd_pcm_ioctl,
 		.compat_ioctl = 	snd_pcm_ioctl_compat,
 		.mmap =			snd_pcm_mmap,
-		.fasync =		snd_pcm_fasync,
 		.get_unmapped_area =	snd_pcm_get_unmapped_area,
 	}
 };
-- 
2.35.3


  parent reply	other threads:[~2022-07-15 10:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15 10:29 [PATCH 0/5] ALSA: Drop async signal support Takashi Iwai
2022-07-15 10:29 ` [PATCH 1/5] ALSA: timer: " Takashi Iwai
2022-07-15 10:29 ` Takashi Iwai [this message]
2022-07-16 17:02   ` [PATCH 2/5] ALSA: pcm: " kernel test robot
2022-07-16 17:53   ` kernel test robot
2022-07-15 10:29 ` [PATCH 3/5] ALSA: control: " Takashi Iwai
2022-07-15 10:29 ` [PATCH 4/5] ALSA: core: " Takashi Iwai
2022-07-15 10:29 ` [PATCH 5/5] ALSA: doc: Drop stale fasync entry 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=20220715102935.4695-3-tiwai@suse.de \
    --to=tiwai@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox