Module Name: src
Committed By: snj
Date: Fri Aug 18 14:58:15 UTC 2017
Modified Files:
src/sys/dev/pci [netbsd-6]: if_ipw.c
Log Message:
Pull up following revision(s) (requested by mrg in ticket #1473):
sys/dev/pci/if_ipw.c: revision 1.65 via patch
Null out sbuf->m on failure to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sbuf->map out of paranoia.
To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.2.1 src/sys/dev/pci/if_ipw.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/pci/if_ipw.c
diff -u src/sys/dev/pci/if_ipw.c:1.53 src/sys/dev/pci/if_ipw.c:1.53.2.1
--- src/sys/dev/pci/if_ipw.c:1.53 Mon Jan 30 19:41:20 2012
+++ src/sys/dev/pci/if_ipw.c Fri Aug 18 14:58:15 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ipw.c,v 1.53 2012/01/30 19:41:20 drochner Exp $ */
+/* $NetBSD: if_ipw.c,v 1.53.2.1 2017/08/18 14:58:15 snj Exp $ */
/* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */
/*-
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.53 2012/01/30 19:41:20 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.53.2.1 2017/08/18 14:58:15 snj Exp $");
/*-
* Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -590,6 +590,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
MCLGET(sbuf->m, M_DONTWAIT);
if (!(sbuf->m->m_flags & M_EXT)) {
m_freem(sbuf->m);
+ sbuf->m = NULL;
aprint_error_dev(&sc->sc_dev, "could not allocate rx mbuf cluster\n");
error = ENOMEM;
goto fail;
@@ -602,6 +603,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
if (error != 0) {
aprint_error_dev(&sc->sc_dev, "could not create rxbuf dma map\n");
m_freem(sbuf->m);
+ sbuf->m = NULL;
goto fail;
}
@@ -609,7 +611,9 @@ ipw_dma_alloc(struct ipw_softc *sc)
sbuf->m, BUS_DMA_READ | BUS_DMA_NOWAIT);
if (error != 0) {
bus_dmamap_destroy(sc->sc_dmat, sbuf->map);
+ sbuf->map = NULL;
m_freem(sbuf->m);
+ sbuf->m = NULL;
aprint_error_dev(&sc->sc_dev, "could not map rxbuf dma memory\n");
goto fail;
}