Skip to content

Commit

Permalink
ALSA: pcm: Drop async signal support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tiwai authored and intel-lab-lkp committed Jul 16, 2022
1 parent 4d62a0b commit 6705167
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
1 change: 0 additions & 1 deletion include/sound/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 1 addition & 3 deletions sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
18 changes: 0 additions & 18 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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,
},
{
Expand All @@ -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,
}
};

0 comments on commit 6705167

Please sign in to comment.