Module Name: src Committed By: nonaka Date: Thu May 18 01:32:46 UTC 2017
Modified Files: src/sys/dev/pci: if_rtwn.c Log Message: Fixed m is not freed if m_defrag() fails. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/if_rtwn.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_rtwn.c diff -u src/sys/dev/pci/if_rtwn.c:1.11 src/sys/dev/pci/if_rtwn.c:1.12 --- src/sys/dev/pci/if_rtwn.c:1.11 Thu Feb 2 10:05:35 2017 +++ src/sys/dev/pci/if_rtwn.c Thu May 18 01:32:46 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_rtwn.c,v 1.11 2017/02/02 10:05:35 nonaka Exp $ */ +/* $NetBSD: if_rtwn.c,v 1.12 2017/05/18 01:32:46 nonaka Exp $ */ /* $OpenBSD: if_rtwn.c,v 1.5 2015/06/14 08:02:47 stsp Exp $ */ #define IEEE80211_NO_HT /*- @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.11 2017/02/02 10:05:35 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.12 2017/05/18 01:32:46 nonaka Exp $"); #include <sys/param.h> #include <sys/sockio.h> @@ -1957,10 +1957,13 @@ rtwn_tx(struct rtwn_softc *sc, struct mb } if (error != 0) { /* Too many DMA segments, linearize mbuf. */ - if ((m = m_defrag(m, M_DONTWAIT)) == NULL) { + struct mbuf *newm = m_defrag(m, M_DONTWAIT); + if (newm == NULL) { aprint_error_dev(sc->sc_dev, "can't defrag mbuf\n"); + m_freem(m); return ENOBUFS; } + m = newm; error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m, BUS_DMA_NOWAIT | BUS_DMA_WRITE);