Module Name: src Committed By: pgoyette Date: Sun Dec 17 22:09:47 UTC 2017
Modified Files: src/sys/dev: fss.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/dev/fss.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/fss.c diff -u src/sys/dev/fss.c:1.99 src/sys/dev/fss.c:1.100 --- src/sys/dev/fss.c:1.99 Sat Oct 28 03:47:24 2017 +++ src/sys/dev/fss.c Sun Dec 17 22:09:47 2017 @@ -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_modcmd(modcmd_t cmd, void *arg) &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;