Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2010 22:44:09 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214226 - head/sys/geom/eli
Message-ID:  <201010222244.o9MMi96J068398@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010222244.o9MMi96J068398>