Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Avoid NULL deref in case no bufq has been set.
details: https://anonhg.NetBSD.org/src/rev/880489c8692b
branches: trunk
changeset: 346111:880489c8692b
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Jun 26 07:22:15 2016 +0000
description:
Avoid NULL deref in case no bufq has been set.
diffstat:
sys/dev/dksubr.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (45 lines):
diff -r 9031745190b9 -r 880489c8692b sys/dev/dksubr.c
--- a/sys/dev/dksubr.c Sun Jun 26 07:10:24 2016 +0000
+++ b/sys/dev/dksubr.c Sun Jun 26 07:22:15 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.86 2016/01/04 10:02:15 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.87 2016/06/26 07:22:15 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.86 2016/01/04 10:02:15 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.87 2016/06/26 07:22:15 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -658,12 +658,13 @@
struct disk_strategy *dks = (void *)data;
mutex_enter(&dksc->sc_iolock);
- strlcpy(dks->dks_name, bufq_getstrategyname(dksc->sc_bufq),
- sizeof(dks->dks_name));
+ if (dksc->sc_bufq != NULL)
+ strlcpy(dks->dks_name, bufq_getstrategyname(dksc->sc_bufq),
+ sizeof(dks->dks_name));
+ else
+ error = EINVAL;
mutex_exit(&dksc->sc_iolock);
dks->dks_paramlen = 0;
-
- return 0;
}
case DIOCSSTRATEGY:
@@ -687,8 +688,6 @@
dksc->sc_bufq = new;
mutex_exit(&dksc->sc_iolock);
bufq_free(old);
-
- return 0;
}
default:
Home |
Main Index |
Thread Index |
Old Index