Commit 67089137 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: pcm: Add missing error checks in OSS emulation plugin builder

In the OSS emulation plugin builder where the frame size is parsed in
the plugin chain, some places miss the possible errors returned from
the plugin src_ or dst_frames callback.

This patch papers over such places.

Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fe08f34d
...@@ -592,18 +592,26 @@ snd_pcm_sframes_t snd_pcm_plug_write_transfer(struct snd_pcm_substream *plug, st ...@@ -592,18 +592,26 @@ snd_pcm_sframes_t snd_pcm_plug_write_transfer(struct snd_pcm_substream *plug, st
snd_pcm_sframes_t frames = size; snd_pcm_sframes_t frames = size;
plugin = snd_pcm_plug_first(plug); plugin = snd_pcm_plug_first(plug);
while (plugin && frames > 0) { while (plugin) {
if (frames <= 0)
return frames;
if ((next = plugin->next) != NULL) { if ((next = plugin->next) != NULL) {
snd_pcm_sframes_t frames1 = frames; snd_pcm_sframes_t frames1 = frames;
if (plugin->dst_frames) if (plugin->dst_frames) {
frames1 = plugin->dst_frames(plugin, frames); frames1 = plugin->dst_frames(plugin, frames);
if (frames1 <= 0)
return frames1;
}
if ((err = next->client_channels(next, frames1, &dst_channels)) < 0) { if ((err = next->client_channels(next, frames1, &dst_channels)) < 0) {
return err; return err;
} }
if (err != frames1) { if (err != frames1) {
frames = err; frames = err;
if (plugin->src_frames) if (plugin->src_frames) {
frames = plugin->src_frames(plugin, frames1); frames = plugin->src_frames(plugin, frames1);
if (frames <= 0)
return frames;
}
} }
} else } else
dst_channels = NULL; dst_channels = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment