alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: alsa-devel@alsa-project.org, Jie Yang <yang.jie@intel.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	LKML <linux-kernel@vger.kernel.org>,
	Alexander Potapenko <glider@google.com>,
	Kostya Serebryany <kcc@google.com>,
	syzkaller <syzkaller@googlegroups.com>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: Re: sound: WARNING in snd_seq_oss_synth_cleanup
Date: Mon, 25 Jan 2016 11:48:18 +0100	[thread overview]
Message-ID: <s5hvb6i9bpp.wl-tiwai@suse.de> (raw)
In-Reply-To: <CACT4Y+bFktAgSCRFom+Y31u6ZScx2seKPZ0JkuErEeJ9sWWmtw@mail.gmail.com>

On Sun, 24 Jan 2016 11:26:47 +0100,
Dmitry Vyukov wrote:
> 
> Hello,
> 
> The following program triggers WARNING in snd_seq_oss_synth_cleanup:
> 
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 7573 at sound/core/seq/oss/seq_oss_synth.c:311
> snd_seq_oss_synth_cleanup+0x35f/0x420()
> Modules linked in:
> CPU: 1 PID: 7573 Comm: a.out Tainted: G        W       4.4.0+ #276
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>  00000000ffffffff ffff880036bcfbb0 ffffffff82999e2d 0000000000000000
>  ffff8800339797c0 ffffffff86d46580 ffff880036bcfbf0 ffffffff81352089
>  ffffffff84fd380f ffffffff86d46580 0000000000000137 ffff880033e592e8
> Call Trace:
>  [<     inline     >] __dump_stack lib/dump_stack.c:15
>  [<ffffffff82999e2d>] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
>  [<ffffffff81352089>] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482
>  [<ffffffff813522b9>] warn_slowpath_null+0x29/0x30 kernel/panic.c:515
>  [<ffffffff84fd380f>] snd_seq_oss_synth_cleanup+0x35f/0x420
> sound/core/seq/oss/seq_oss_synth.c:311
>  [<ffffffff84fca919>] snd_seq_oss_release+0x79/0x130
> sound/core/seq/oss/seq_oss_init.c:427
>  [<ffffffff84fc8faa>] odev_release+0x5a/0x80 sound/core/seq/oss/seq_oss.c:155
>  [<ffffffff817b73c6>] __fput+0x236/0x780 fs/file_table.c:208
>  [<ffffffff817b7995>] ____fput+0x15/0x20 fs/file_table.c:244
>  [<ffffffff813afdc0>] task_work_run+0x170/0x210 kernel/task_work.c:115
>  [<     inline     >] exit_task_work include/linux/task_work.h:21
>  [<ffffffff8135b275>] do_exit+0x8b5/0x2c60 kernel/exit.c:750
>  [<ffffffff8135d798>] do_group_exit+0x108/0x330 kernel/exit.c:880
>  [<     inline     >] SYSC_exit_group kernel/exit.c:891
>  [<ffffffff8135d9dd>] SyS_exit_group+0x1d/0x20 kernel/exit.c:889
>  [<ffffffff86336c36>] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185
> ---[ end trace e71270304b7f911a ]---
> 
> 
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> 
> int main()
> {
>     open("/dev/char/14:8", O_RDWR);
> }
> 
> On commit 30f05309bde49295e02e45c7e615f73aa4e0ccc2.

This must be an off-by-one error.  The fix patch is below.


thanks,

Takashi

-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: seq: Fix incorrect sanity check at
 snd_seq_oss_synth_cleanup()

ALSA sequencer OSS emulation code has a sanity check for currently
opened devices, but there is a thinko there, eventually it spews
warnings and skips the operation wrongly.

Fix this off-by-one error.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/seq/oss/seq_oss_synth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index 0f3b38184fe5..b16dbef04174 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -308,7 +308,7 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp)
 	struct seq_oss_synth *rec;
 	struct seq_oss_synthinfo *info;
 
-	if (snd_BUG_ON(dp->max_synthdev >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS))
+	if (snd_BUG_ON(dp->max_synthdev > SNDRV_SEQ_OSS_MAX_SYNTH_DEVS))
 		return;
 	for (i = 0; i < dp->max_synthdev; i++) {
 		info = &dp->synths[i];
-- 
2.7.0

      reply	other threads:[~2016-01-25 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-24 10:26 sound: WARNING in snd_seq_oss_synth_cleanup Dmitry Vyukov
2016-01-25 10:48 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hvb6i9bpp.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=sasha.levin@oracle.com \
    --cc=syzkaller@googlegroups.com \
    --cc=yang.jie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).