From owner-svn-src-all@FreeBSD.ORG Fri Oct 22 22:44:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F26A106566B; Fri, 22 Oct 2010 22:44:09 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E49C8FC13; Fri, 22 Oct 2010 22:44:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9MMi9Ex068400; Fri, 22 Oct 2010 22:44:09 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MMi96J068398; Fri, 22 Oct 2010 22:44:09 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010222244.o9MMi96J068398@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 22 Oct 2010 22:44:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214226 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Oct 2010 22:44:09 -0000 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);