diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-08-29 07:48:46 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-08-29 07:48:46 +0000 |
commit | 853f91fa6d0acbc4fd3080b0af5b99bbce7e9808 (patch) | |
tree | fa30bec487a4f428f5ffd306d62679d0263b5d85 | |
parent | 06727600679b779481a626d4231f94662e4cc3b2 (diff) |
Don't write to mbuf length fields before mbuf is removed from iwm(4) Rx ring.
Based on Dragonfly 96eaecf93d9f731459a0df8efc72cfad034320bd by Imre Vadasz
ok mpi@ procter@
-rw-r--r-- | sys/dev/pci/if_iwm.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index a60b631f653..55c1586845c 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.245 2019/08/27 14:57:48 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.246 2019/08/29 07:48:45 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh <info@genua.de> @@ -3552,10 +3552,6 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct iwm_rx_packet *pkt, rx_pkt_status = le32toh(*(uint32_t *)(pkt->data + sizeof(*rx_res) + len)); - m = data->m; - m->m_data = pkt->data + sizeof(*rx_res); - m->m_pkthdr.len = m->m_len = len; - if (__predict_false(phy_info->cfg_phy_cnt > 20)) return; @@ -3563,6 +3559,12 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct iwm_rx_packet *pkt, !(rx_pkt_status & IWM_RX_MPDU_RES_STATUS_OVERRUN_OK)) return; /* drop */ + m = data->m; + if (iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0) + return; + m->m_data = pkt->data + sizeof(*rx_res); + m->m_pkthdr.len = m->m_len = len; + device_timestamp = le32toh(phy_info->system_timestamp); if (sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_RX_ENERGY_API) { @@ -3573,9 +3575,6 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct iwm_rx_packet *pkt, rssi = (0 - IWM_MIN_DBM) + rssi; /* normalize */ rssi = MIN(rssi, ic->ic_max_rssi); /* clip to max. 100% */ - if (iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0) - return; - chanidx = letoh32(phy_info->channel); if (chanidx < 0 || chanidx >= nitems(ic->ic_channels)) chanidx = ieee80211_chan2ieee(ic, ic->ic_ibss_chan); |