Commit 3d4e8303 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: timer: Remove kernel warning at compat ioctl error paths

Some timer compat ioctls have NULL checks of timer instance with
snd_BUG_ON() that bring up WARN_ON() when the debug option is set.
Actually the condition can be met in the normal situation and it's
confusing and bad to spew kernel warnings with stack trace there.
Let's remove snd_BUG_ON() invocation and replace with the simple
checks.  Also, correct the error code to EBADFD to follow the native
ioctl error handling.
Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 20e3f985
...@@ -66,11 +66,11 @@ static int snd_timer_user_info_compat(struct file *file, ...@@ -66,11 +66,11 @@ static int snd_timer_user_info_compat(struct file *file,
struct snd_timer *t; struct snd_timer *t;
tu = file->private_data; tu = file->private_data;
if (snd_BUG_ON(!tu->timeri)) if (!tu->timeri)
return -ENXIO; return -EBADFD;
t = tu->timeri->timer; t = tu->timeri->timer;
if (snd_BUG_ON(!t)) if (!t)
return -ENXIO; return -EBADFD;
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
info.card = t->card ? t->card->number : -1; info.card = t->card ? t->card->number : -1;
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE) if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
...@@ -99,8 +99,8 @@ static int snd_timer_user_status_compat(struct file *file, ...@@ -99,8 +99,8 @@ static int snd_timer_user_status_compat(struct file *file,
struct snd_timer_status32 status; struct snd_timer_status32 status;
tu = file->private_data; tu = file->private_data;
if (snd_BUG_ON(!tu->timeri)) if (!tu->timeri)
return -ENXIO; return -EBADFD;
memset(&status, 0, sizeof(status)); memset(&status, 0, sizeof(status));
status.tstamp.tv_sec = tu->tstamp.tv_sec; status.tstamp.tv_sec = tu->tstamp.tv_sec;
status.tstamp.tv_nsec = tu->tstamp.tv_nsec; status.tstamp.tv_nsec = tu->tstamp.tv_nsec;
......
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