Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Null out sc_rx_mbuf[i] after m_freem to avoid dou...
details: https://anonhg.NetBSD.org/src/rev/ec54666e86f6
branches: trunk
changeset: 355432:ec54666e86f6
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Jul 29 01:45:22 2017 +0000
description:
Null out sc_rx_mbuf[i] after m_freem to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sc_tx_mbuf[i] after m_freem, out of paranoia.
XXX Not entirely clear to how tx mbufs are freed, but no way to test
this since it's ews4800mips- and hp700-only, so not keen to make any
more elaborate changes...
diffstat:
sys/dev/ic/i82596.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (66 lines):
diff -r dc5f171e970f -r ec54666e86f6 sys/dev/ic/i82596.c
--- a/sys/dev/ic/i82596.c Sat Jul 29 01:34:49 2017 +0000
+++ b/sys/dev/ic/i82596.c Sat Jul 29 01:45:22 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82596.c,v 1.36 2017/02/20 07:43:29 ozaki-r Exp $ */
+/* $NetBSD: i82596.c,v 1.37 2017/07/29 01:45:22 riastradh Exp $ */
/*
* Copyright (c) 2003 Jochen Kunz.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.36 2017/02/20 07:43:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.37 2017/07/29 01:45:22 riastradh Exp $");
/* autoconfig and device stuff */
#include <sys/param.h>
@@ -753,6 +753,7 @@
printf("%s: iee_start: can't allocate mbuf\n",
device_xname(sc->sc_dev));
m_freem(sc->sc_tx_mbuf[t]);
+ sc->sc_tx_mbuf[t] = NULL;
t--;
continue;
}
@@ -762,6 +763,7 @@
printf("%s: iee_start: can't allocate mbuf "
"cluster\n", device_xname(sc->sc_dev));
m_freem(sc->sc_tx_mbuf[t]);
+ sc->sc_tx_mbuf[t] = NULL;
m_freem(m);
t--;
continue;
@@ -777,6 +779,7 @@
printf("%s: iee_start: can't load TX DMA map\n",
device_xname(sc->sc_dev));
m_freem(sc->sc_tx_mbuf[t]);
+ sc->sc_tx_mbuf[t] = NULL;
t--;
continue;
}
@@ -926,6 +929,7 @@
printf("%s: iee_init: can't allocate mbuf"
" cluster\n", device_xname(sc->sc_dev));
m_freem(sc->sc_rx_mbuf[r]);
+ sc->sc_rx_mbuf[r] = NULL;
err = 1;
break;
}
@@ -939,6 +943,7 @@
printf("%s: iee_init: can't create RX "
"DMA map\n", device_xname(sc->sc_dev));
m_freem(sc->sc_rx_mbuf[r]);
+ sc->sc_rx_mbuf[r] = NULL;
err = 1;
break;
}
@@ -948,6 +953,7 @@
device_xname(sc->sc_dev));
bus_dmamap_destroy(sc->sc_dmat, sc->sc_rx_map[r]);
m_freem(sc->sc_rx_mbuf[r]);
+ sc->sc_rx_mbuf[r] = NULL;
err = 1;
break;
}
Home |
Main Index |
Thread Index |
Old Index