Skip to content

Commit 6708913

Browse files
committed
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: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent fe08f34 commit 6708913

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sound/core/oss/pcm_plugin.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,18 +592,26 @@ snd_pcm_sframes_t snd_pcm_plug_write_transfer(struct snd_pcm_substream *plug, st
592592
snd_pcm_sframes_t frames = size;
593593

594594
plugin = snd_pcm_plug_first(plug);
595-
while (plugin && frames > 0) {
595+
while (plugin) {
596+
if (frames <= 0)
597+
return frames;
596598
if ((next = plugin->next) != NULL) {
597599
snd_pcm_sframes_t frames1 = frames;
598-
if (plugin->dst_frames)
600+
if (plugin->dst_frames) {
599601
frames1 = plugin->dst_frames(plugin, frames);
602+
if (frames1 <= 0)
603+
return frames1;
604+
}
600605
if ((err = next->client_channels(next, frames1, &dst_channels)) < 0) {
601606
return err;
602607
}
603608
if (err != frames1) {
604609
frames = err;
605-
if (plugin->src_frames)
610+
if (plugin->src_frames) {
606611
frames = plugin->src_frames(plugin, frames1);
612+
if (frames <= 0)
613+
return frames;
614+
}
607615
}
608616
} else
609617
dst_channels = NULL;

0 commit comments

Comments
 (0)