Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/specfs If we attempt to autoload a driver module, ...
details: https://anonhg.NetBSD.org/src/rev/c1b601c8b671
branches: trunk
changeset: 342460:c1b601c8b671
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Dec 22 23:54:37 2015 +0000
description:
If we attempt to autoload a driver module, make sure we return an error
if it fails. Otherwise we might end up calling a builtin-but-disabled
driver module and that can generate all sorts of issues...
diffstat:
sys/miscfs/specfs/spec_vnops.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diffs (50 lines):
diff -r 25cfe5dd478f -r c1b601c8b671 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Tue Dec 22 23:35:21 2015 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Tue Dec 22 23:54:37 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.157 2015/12/08 20:36:15 christos Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.158 2015/12/22 23:54:37 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.157 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.158 2015/12/22 23:54:37 pgoyette Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -573,7 +573,12 @@
break;
/* Try to autoload device module */
- (void) module_autoload(name, MODULE_CLASS_DRIVER);
+ error = module_autoload(name, MODULE_CLASS_DRIVER);
+ if (error != 0) {
+ error = ENXIO;
+ break;
+ }
+
} while (gen != module_gen);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@@ -624,9 +629,15 @@
VOP_UNLOCK(vp);
/* Try to autoload device module */
- (void) module_autoload(name, MODULE_CLASS_DRIVER);
+ error = module_autoload(name, MODULE_CLASS_DRIVER);
+
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+
+ if (error != 0) {
+ error = ENXIO;
+ break;
+ }
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
} while (gen != module_gen);
break;
Home |
Main Index |
Thread Index |
Old Index