summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@FreeBSD.org>2005-07-03 15:42:18 +0000
committerdamien <damien@FreeBSD.org>2005-07-03 15:42:18 +0000
commitb212a85edc3a278742a2d163513290fa192b2735 (patch)
tree03e53ebd55c285c3ecda4c41359a7c3f8cba4d29
parent0f0e5d42a8365f5188a3a11ef1046863d83bda0c (diff)
downloadFreeBSD-src-b212a85edc3a278742a2d163513290fa192b2735.zip
FreeBSD-src-b212a85edc3a278742a2d163513290fa192b2735.tar.gz
o Make ipw(4) more robust against frames received with a bad length.
o Minor consistency tweaks. Reviewed by: silby (mentor) Approved by: re (scottl)
-rw-r--r--sys/dev/ipw/if_ipw.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c
index 11322af..bab7a72 100644
--- a/sys/dev/ipw/if_ipw.c
+++ b/sys/dev/ipw/if_ipw.c
@@ -263,11 +263,13 @@ ipw_attach(device_t dev)
device_printf(dev, "could not allocate DMA resources\n");
goto fail;
}
+
ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
device_printf(dev, "can not if_alloc()\n");
goto fail;
}
+
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
@@ -391,11 +393,11 @@ ipw_detach(device_t dev)
IPW_UNLOCK(sc);
- if (ifp != NULL)
+ if (ifp != NULL) {
bpfdetach(ifp);
- ieee80211_ifdetach(ic);
- if (ifp != NULL)
+ ieee80211_ifdetach(ic);
if_free(ifp);
+ }
ipw_release(sc);
@@ -1018,6 +1020,10 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status,
bus_addr_t physaddr;
int error;
+ if (le32toh(status->len) < sizeof (struct ieee80211_frame_min) ||
+ le32toh(status->len) > MCLBYTES)
+ return;
+
bus_dmamap_sync(sc->rxbuf_dmat, sbuf->map, BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(sc->rxbuf_dmat, sbuf->map);
OpenPOWER on IntegriCloud