Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Fixed m is not freed if m_defrag() fails.
details: https://anonhg.NetBSD.org/src/rev/6d950fb5e46e
branches: trunk
changeset: 353690:6d950fb5e46e
user: nonaka <nonaka%NetBSD.org@localhost>
date: Thu May 18 01:32:46 2017 +0000
description:
Fixed m is not freed if m_defrag() fails.
diffstat:
sys/dev/pci/if_rtwn.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r 196780af1c52 -r 6d950fb5e46e sys/dev/pci/if_rtwn.c
--- a/sys/dev/pci/if_rtwn.c Wed May 17 22:43:12 2017 +0000
+++ b/sys/dev/pci/if_rtwn.c Thu May 18 01:32:46 2017 +0000
@@ -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 @@
}
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);
Home |
Main Index |
Thread Index |
Old Index