Skip to content

Commit ef67455

Browse files
tiwaigregkh
authored andcommitted
ALSA: timer: Remove kernel warning at compat ioctl error paths
commit 3d4e8303f2c747c8540a0a0126d0151514f6468b upstream. 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: syzbot <syzkaller@googlegroups.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3532750 commit ef67455

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

sound/core/timer_compat.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ static int snd_timer_user_info_compat(struct file *file,
4040
struct snd_timer *t;
4141

4242
tu = file->private_data;
43-
if (snd_BUG_ON(!tu->timeri))
44-
return -ENXIO;
43+
if (!tu->timeri)
44+
return -EBADFD;
4545
t = tu->timeri->timer;
46-
if (snd_BUG_ON(!t))
47-
return -ENXIO;
46+
if (!t)
47+
return -EBADFD;
4848
memset(&info, 0, sizeof(info));
4949
info.card = t->card ? t->card->number : -1;
5050
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
@@ -73,8 +73,8 @@ static int snd_timer_user_status_compat(struct file *file,
7373
struct snd_timer_status32 status;
7474

7575
tu = file->private_data;
76-
if (snd_BUG_ON(!tu->timeri))
77-
return -ENXIO;
76+
if (!tu->timeri)
77+
return -EBADFD;
7878
memset(&status, 0, sizeof(status));
7979
status.tstamp.tv_sec = tu->tstamp.tv_sec;
8080
status.tstamp.tv_nsec = tu->tstamp.tv_nsec;

0 commit comments

Comments
 (0)