Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: pcm: oss: Remove WARNING from snd_pcm_plug_alloc() checks

The return value checks in snd_pcm_plug_alloc() are covered with
snd_BUG_ON() macro that may trigger a kernel WARNING depending on the
kconfig. But since the error condition can be triggered by a weird
user space parameter passed to OSS layer, we shouldn't give the kernel
stack trace just for that. As it's a normal error condition, let's
remove snd_BUG_ON() macro usage there.

Reported-by: syzbot+2a59ee7a9831b264f45e@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200312155730.7520-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+2 -2
+2 -2
sound/core/oss/pcm_plugin.c
··· 111 111 while (plugin->next) { 112 112 if (plugin->dst_frames) 113 113 frames = plugin->dst_frames(plugin, frames); 114 - if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) 114 + if ((snd_pcm_sframes_t)frames <= 0) 115 115 return -ENXIO; 116 116 plugin = plugin->next; 117 117 err = snd_pcm_plugin_alloc(plugin, frames); ··· 123 123 while (plugin->prev) { 124 124 if (plugin->src_frames) 125 125 frames = plugin->src_frames(plugin, frames); 126 - if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) 126 + if ((snd_pcm_sframes_t)frames <= 0) 127 127 return -ENXIO; 128 128 plugin = plugin->prev; 129 129 err = snd_pcm_plugin_alloc(plugin, frames);