svn commit: r214226 - head/sys/geom/eli
Pawel Jakub Dawidek
pjd at FreeBSD.org
Fri Oct 22 22:44:09 UTC 2010
Author: pjd
Date: Fri Oct 22 22:44:09 2010
New Revision: 214226
URL: http://svn.freebsd.org/changeset/base/214226
Log:
Encryption keys array might be NULL if device is suspended. Check for this, so
we don't panic when we detach suspended device.
Modified:
head/sys/geom/eli/g_eli.c
Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c Fri Oct 22 22:13:11 2010 (r214225)
+++ head/sys/geom/eli/g_eli.c Fri Oct 22 22:44:09 2010 (r214226)
@@ -952,9 +952,12 @@ g_eli_destroy(struct g_eli_softc *sc, bo
}
mtx_destroy(&sc->sc_queue_mtx);
gp->softc = NULL;
- bzero(sc->sc_ekeys,
- sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN));
- free(sc->sc_ekeys, M_ELI);
+ if (sc->sc_ekeys != NULL) {
+ /* The sc_ekeys field can be NULL is device is suspended. */
+ bzero(sc->sc_ekeys,
+ sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN));
+ free(sc->sc_ekeys, M_ELI);
+ }
bzero(sc, sizeof(*sc));
free(sc, M_ELI);
More information about the svn-src-head
mailing list