fix mbuf leak on failure (Brainy)
This commit is contained in:
parent
6ff99d8719
commit
f7924c012b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hifn7751.c,v 1.57 2015/04/13 16:33:25 riastradh Exp $ */
|
||||
/* $NetBSD: hifn7751.c,v 1.58 2015/04/27 17:38:01 christos Exp $ */
|
||||
/* $FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
|
||||
/* $OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $ */
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.57 2015/04/13 16:33:25 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.58 2015/04/27 17:38:01 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -3123,6 +3123,7 @@ hifn_mkmbuf_chain(int totlen, struct mbuf *mtemplate)
|
|||
}
|
||||
MCLGET(m, M_DONTWAIT);
|
||||
if (!(m->m_flags & M_EXT)) {
|
||||
m_freem(m);
|
||||
m_freem(m0);
|
||||
return (NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_bge.c,v 1.282 2015/04/13 16:33:25 riastradh Exp $ */
|
||||
/* $NetBSD: if_bge.c,v 1.283 2015/04/27 17:42:20 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wind River Systems
|
||||
|
@ -79,7 +79,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.282 2015/04/13 16:33:25 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.283 2015/04/27 17:42:20 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -1744,8 +1744,10 @@ bge_newbuf_std(struct bge_softc *sc, int i, struct mbuf *m,
|
|||
if (!(sc->bge_flags & BGEF_RX_ALIGNBUG))
|
||||
m_adj(m_new, ETHER_ALIGN);
|
||||
if (bus_dmamap_load_mbuf(sc->bge_dmatag, dmamap, m_new,
|
||||
BUS_DMA_READ|BUS_DMA_NOWAIT))
|
||||
BUS_DMA_READ|BUS_DMA_NOWAIT)) {
|
||||
m_freem(m_new);
|
||||
return ENOBUFS;
|
||||
}
|
||||
bus_dmamap_sync(sc->bge_dmatag, dmamap, 0, dmamap->dm_mapsize,
|
||||
BUS_DMASYNC_PREREAD);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_pcn.c,v 1.59 2015/04/13 16:33:25 riastradh Exp $ */
|
||||
/* $NetBSD: if_pcn.c,v 1.60 2015/04/27 17:40:13 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.59 2015/04/13 16:33:25 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.60 2015/04/27 17:40:13 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -982,6 +982,7 @@ pcn_start(struct ifnet *ifp)
|
|||
printf("%s: unable to load Tx buffer, "
|
||||
"error = %d\n", device_xname(sc->sc_dev),
|
||||
error);
|
||||
m_freem(m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ti.c,v 1.93 2014/03/29 19:28:25 christos Exp $ */
|
||||
/* $NetBSD: if_ti.c,v 1.94 2015/04/27 17:41:26 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999
|
||||
|
@ -81,7 +81,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.93 2014/03/29 19:28:25 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.94 2015/04/27 17:41:26 christos Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -733,6 +733,7 @@ ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m, bus_dmamap_t dmamap)
|
|||
BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
|
||||
aprint_error_dev(sc->sc_dev, "can't load recv map, error = %d\n",
|
||||
error);
|
||||
m_freem(m_new);
|
||||
return (ENOMEM);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue