summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2000-07-09 00:18:21 +0000
committermjacob <mjacob@FreeBSD.org>2000-07-09 00:18:21 +0000
commit712e1316bf306af7da62bbcc7b8532c1b7d81e03 (patch)
tree799620d7a2aacc9addcedd3c4142b29a7c51e622 /sys
parent9cf5f6a087ca657428c03b8ed3659fc7d41370e8 (diff)
downloadFreeBSD-src-712e1316bf306af7da62bbcc7b8532c1b7d81e03.zip
FreeBSD-src-712e1316bf306af7da62bbcc7b8532c1b7d81e03.tar.gz
Thanks for Andrew Gallatin pointing out that freeing contigmalloc'd
items via free is bad.
Diffstat (limited to 'sys')
-rw-r--r--sys/pci/if_wx.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/pci/if_wx.c b/sys/pci/if_wx.c
index a93b97a..5fd2b28 100644
--- a/sys/pci/if_wx.c
+++ b/sys/pci/if_wx.c
@@ -698,6 +698,8 @@ wx_dring_setup(sc)
return (-1);
}
if (((u_long)sc->rdescriptors) & 0xfff) {
+ contigfree(sc->rdescriptors, len, M_DEVBUF);
+ sc->rdescriptors = NULL;
printf("%s: rcv descriptors not 4KB aligned\n", sc->wx_name);
return (-1);
}
@@ -707,10 +709,16 @@ wx_dring_setup(sc)
sc->tdescriptors = (wxtd_t *)
contigmalloc(len, M_DEVBUF, M_NOWAIT, 0, ~0, 4096, 0);
if (sc->tdescriptors == NULL) {
+ contigfree(sc->rdescriptors,
+ sizeof (wxrd_t) * WX_MAX_RDESC, M_DEVBUF);
+ sc->rdescriptors = NULL;
printf("%s: could not allocate xmt descriptors\n", sc->wx_name);
return (-1);
}
if (((u_long)sc->tdescriptors) & 0xfff) {
+ contigfree(sc->rdescriptors,
+ sizeof (wxrd_t) * WX_MAX_RDESC, M_DEVBUF);
+ sc->rdescriptors = NULL;
printf("%s: xmt descriptors not 4KB aligned\n", sc->wx_name);
return (-1);
}
@@ -723,11 +731,13 @@ wx_dring_teardown(sc)
wx_softc_t *sc;
{
if (sc->rdescriptors) {
- WXFREE(sc->rdescriptors);
+ contigfree(sc->rdescriptors,
+ sizeof (wxrd_t) * WX_MAX_RDESC, M_DEVBUF);
sc->rdescriptors = NULL;
}
if (sc->tdescriptors) {
- WXFREE(sc->tdescriptors);
+ contigfree(sc->tdescriptors,
+ sizeof (wxtd_t) * WX_MAX_TDESC, M_DEVBUF);
sc->tdescriptors = NULL;
}
}
OpenPOWER on IntegriCloud