]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.85/alsa-timer-remove-kernel-warning-at-compat-ioctl-error-paths.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.18.85 / alsa-timer-remove-kernel-warning-at-compat-ioctl-error-paths.patch
CommitLineData
d992de84
GKH
1From 3d4e8303f2c747c8540a0a0126d0151514f6468b Mon Sep 17 00:00:00 2001
2From: Takashi Iwai <tiwai@suse.de>
3Date: Tue, 21 Nov 2017 16:36:11 +0100
4Subject: ALSA: timer: Remove kernel warning at compat ioctl error paths
5
6From: Takashi Iwai <tiwai@suse.de>
7
8commit 3d4e8303f2c747c8540a0a0126d0151514f6468b upstream.
9
10Some timer compat ioctls have NULL checks of timer instance with
11snd_BUG_ON() that bring up WARN_ON() when the debug option is set.
12Actually the condition can be met in the normal situation and it's
13confusing and bad to spew kernel warnings with stack trace there.
14Let's remove snd_BUG_ON() invocation and replace with the simple
15checks. Also, correct the error code to EBADFD to follow the native
16ioctl error handling.
17
18Reported-by: syzbot <syzkaller@googlegroups.com>
19Signed-off-by: Takashi Iwai <tiwai@suse.de>
20Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22---
23 sound/core/timer_compat.c | 12 ++++++------
24 1 file changed, 6 insertions(+), 6 deletions(-)
25
26--- a/sound/core/timer_compat.c
27+++ b/sound/core/timer_compat.c
28@@ -40,11 +40,11 @@ static int snd_timer_user_info_compat(st
29 struct snd_timer *t;
30
31 tu = file->private_data;
32- if (snd_BUG_ON(!tu->timeri))
33- return -ENXIO;
34+ if (!tu->timeri)
35+ return -EBADFD;
36 t = tu->timeri->timer;
37- if (snd_BUG_ON(!t))
38- return -ENXIO;
39+ if (!t)
40+ return -EBADFD;
41 memset(&info, 0, sizeof(info));
42 info.card = t->card ? t->card->number : -1;
43 if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
44@@ -73,8 +73,8 @@ static int snd_timer_user_status_compat(
45 struct snd_timer_status32 status;
46
47 tu = file->private_data;
48- if (snd_BUG_ON(!tu->timeri))
49- return -ENXIO;
50+ if (!tu->timeri)
51+ return -EBADFD;
52 memset(&status, 0, sizeof(status));
53 status.tstamp.tv_sec = tu->tstamp.tv_sec;
54 status.tstamp.tv_nsec = tu->tstamp.tv_nsec;