Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Possibile vchan mixer overflow panic avoided.
details: https://anonhg.NetBSD.org/src/rev/175c0b4664ab
branches: trunk
changeset: 353633:175c0b4664ab
user: nat <nat%NetBSD.org@localhost>
date: Mon May 15 09:43:56 2017 +0000
description:
Possibile vchan mixer overflow panic avoided.
diffstat:
sys/dev/audio.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (42 lines):
diff -r 248a6d0ed4a3 -r 175c0b4664ab sys/dev/audio.c
--- a/sys/dev/audio.c Mon May 15 04:54:09 2017 +0000
+++ b/sys/dev/audio.c Mon May 15 09:43:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.347 2017/05/15 01:03:47 nat Exp $ */
+/* $NetBSD: audio.c,v 1.348 2017/05/15 09:43:56 nat Exp $ */
/*-
* Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.347 2017/05/15 01:03:47 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.348 2017/05/15 09:43:56 nat Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -5741,8 +5741,9 @@
KASSERT(mutex_owned(sc->sc_lock));
int d = mc->dev - sc->sc_static_nmixer_states;
-
- if (d == -1)
+ int u = sc->sc_nmixer_states - sc->sc_static_nmixer_states;
+
+ if (d == -1 || d >= u)
return 0;
if (d < 0)
return sc->hw_if->set_port(sc->hw_hdl, mc);
@@ -5761,8 +5762,9 @@
KASSERT(mutex_owned(sc->sc_lock));
int d = mc->dev - sc->sc_static_nmixer_states;
-
- if (d == -1)
+ int u = sc->sc_nmixer_states - sc->sc_static_nmixer_states;
+
+ if (d == -1 || d >= u)
return 0;
if (d < 0)
return sc->hw_if->get_port(sc->hw_hdl, mc);
Home |
Main Index |
Thread Index |
Old Index