Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys/dev Apply patch (requested by chs in ticket #1455):
details: https://anonhg.NetBSD.org/src/rev/c790a24731d6
branches: netbsd-6
changeset: 777189:c790a24731d6
user: snj <snj%NetBSD.org@localhost>
date: Fri Jul 21 04:02:12 2017 +0000
description:
Apply patch (requested by chs in ticket #1455):
Avoid crashes by checking if a cgd device has been configured before
processing most ioctls, and failing with ENXIO if the device is not
configured.
diffstat:
sys/dev/cgd.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r c65b97e999fa -r c790a24731d6 sys/dev/cgd.c
--- a/sys/dev/cgd.c Fri Jul 21 03:53:08 2017 +0000
+++ b/sys/dev/cgd.c Fri Jul 21 04:02:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.76.6.1 2014/06/03 09:17:52 sborrill Exp $ */
+/* $NetBSD: cgd.c,v 1.76.6.2 2017/07/21 04:02:12 snj Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.76.6.1 2014/06/03 09:17:52 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.76.6.2 2017/07/21 04:02:12 snj Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -558,12 +558,16 @@
*/
if ((flag & FWRITE) == 0)
return (EBADF);
+ if ((dksc->sc_flags & DKF_INITED) == 0)
+ return ENXIO;
/*
* We pass this call down to the underlying disk.
*/
return VOP_IOCTL(cs->sc_tvn, cmd, data, flag, l->l_cred);
default:
+ if ((dksc->sc_flags & DKF_INITED) == 0)
+ return ENXIO;
return dk_ioctl(di, dksc, dev, cmd, data, flag, l);
}
}
Home |
Main Index |
Thread Index |
Old Index