Module Name: src Committed By: martin Date: Mon Oct 28 19:12:18 UTC 2019
Modified Files: src/sys/dev [netbsd-8]: audio.c Log Message: Apply patch, requested by nat in ticket #1419: PR kern/54547: do not allow mmap() of audio devices that have not been opened for r/w. To generate a diff of this commit: cvs rdiff -u -r1.357.2.13 -r1.357.2.14 src/sys/dev/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/audio.c diff -u src/sys/dev/audio.c:1.357.2.13 src/sys/dev/audio.c:1.357.2.14 --- src/sys/dev/audio.c:1.357.2.13 Thu Jun 7 18:24:16 2018 +++ src/sys/dev/audio.c Mon Oct 28 19:12:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.357.2.13 2018/06/07 18:24:16 martin Exp $ */ +/* $NetBSD: audio.c,v 1.357.2.14 2019/10/28 19:12:17 martin Exp $ */ /*- * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au> @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.13 2018/06/07 18:24:16 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.14 2019/10/28 19:12:17 martin Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -3521,6 +3521,9 @@ audio_mmap(struct audio_softc *sc, off_t if (!(audio_get_props(sc) & AUDIO_PROP_MMAP)) return ENOTSUP; + if (vc->sc_open != AUOPEN_WRITE) + return EINVAL; + if (*offp < 0) return EINVAL;