Module Name: src
Committed By: cegger
Date: Fri Apr 17 15:16:52 UTC 2009
Modified Files:
src/sys/dev/ic: tulip.c
Log Message:
set dmamap to NULL when bus_dmamap_create() fails to prevent bus_dmamap_destroy
to be called with an invalid dmamap in error path.
To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/ic/tulip.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/ic/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.167 src/sys/dev/ic/tulip.c:1.168
--- src/sys/dev/ic/tulip.c:1.167 Fri Apr 17 10:20:33 2009
+++ src/sys/dev/ic/tulip.c Fri Apr 17 15:16:52 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: tulip.c,v 1.167 2009/04/17 10:20:33 cegger Exp $ */
+/* $NetBSD: tulip.c,v 1.168 2009/04/17 15:16:52 cegger Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.167 2009/04/17 10:20:33 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.168 2009/04/17 15:16:52 cegger Exp $");
#include "bpfilter.h"
@@ -415,6 +415,7 @@
if ((error = bus_dmamap_create(sc->sc_dmat,
sizeof(struct tulip_control_data), 1,
sizeof(struct tulip_control_data), 0, 0, &sc->sc_cddmamap)) != 0) {
+ sc->sc_cddmamap = NULL;
aprint_error_dev(self, "unable to create control data DMA map, "
"error = %d\n", error);
goto fail_2;
@@ -455,6 +456,7 @@
if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
sc->sc_ntxsegs, MCLBYTES, 0, 0,
&sc->sc_txsoft[i].txs_dmamap)) != 0) {
+ sc->sc_txsoft[i].txs_dmamap = NULL;
aprint_error_dev(self, "unable to create tx DMA map %d, "
"error = %d\n", i, error);
goto fail_4;
@@ -467,6 +469,7 @@
for (i = 0; i < TULIP_NRXDESC; i++) {
if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1,
MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) {
+ sc->sc_rxsoft[i].rxs_dmamap = NULL;
aprint_error_dev(self, "unable to create rx DMA map %d, "
"error = %d\n", i, error);
goto fail_5;