Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev If config_cfattach_detach() returns an error, handle...
details: https://anonhg.NetBSD.org/src/rev/8682b3c36439
branches: trunk
changeset: 358218:8682b3c36439
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sun Dec 17 22:09:47 2017 +0000
description:
If config_cfattach_detach() returns an error, handle it instead of
ignoring. Otherwise the mutex will get destroyed and we'll unload
the module, and any active users will eventually cause a panic.
Noted by code inspection.
XXX pullup to netbsd-8
diffstat:
sys/dev/fss.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r 95474e9d8a0c -r 8682b3c36439 sys/dev/fss.c
--- a/sys/dev/fss.c Sun Dec 17 21:57:11 2017 +0000
+++ b/sys/dev/fss.c Sun Dec 17 22:09:47 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.99 2017/10/28 03:47:24 riastradh Exp $ */
+/* $NetBSD: fss.c,v 1.100 2017/12/17 22:09:47 pgoyette Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.99 2017/10/28 03:47:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.100 2017/12/17 22:09:47 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1321,7 +1321,14 @@
&fss_cdevsw, &fss_cmajor);
break;
}
- config_cfdriver_detach(&fss_cd);
+ error = config_cfdriver_detach(&fss_cd);
+ if (error) {
+ devsw_attach(fss_cd.cd_name,
+ &fss_bdevsw, &fss_bmajor, &fss_cdevsw, &fss_cmajor);
+ devsw_attach(fss_cd.cd_name, &fss_bdevsw, &fss_bmajor,
+ &fss_cdevsw, &fss_cmajor);
+ break;
+ }
mutex_destroy(&fss_device_lock);
break;
Home |
Main Index |
Thread Index |
Old Index