summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/if_iwx.c
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2020-02-28 14:18:07 +0000
committerstsp <stsp@openbsd.org>2020-02-28 14:18:07 +0000
commit51598d91dc314676d742240bfeb9fb9de298b5e4 (patch)
treea91247e4ddc6b667627a4184f0f5fa38ae01ada6 /sys/dev/pci/if_iwx.c
parentSync monitor mode fixes from iwm(4) to iwx(4): (diff)
downloadwireguard-openbsd-51598d91dc314676d742240bfeb9fb9de298b5e4.tar.xz
wireguard-openbsd-51598d91dc314676d742240bfeb9fb9de298b5e4.zip
In iwx(4), free mbufs that won't be passed to if_inputm().
Diffstat (limited to 'sys/dev/pci/if_iwx.c')
-rw-r--r--sys/dev/pci/if_iwx.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c
index 2f40fa4c709..c7df7396605 100644
--- a/sys/dev/pci/if_iwx.c
+++ b/sys/dev/pci/if_iwx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwx.c,v 1.3 2020/02/28 14:17:48 stsp Exp $ */
+/* $OpenBSD: if_iwx.c,v 1.4 2020/02/28 14:18:07 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -3461,17 +3461,21 @@ iwx_rx_mpdu_mq(struct iwx_softc *sc, struct mbuf *m, void *pktdata,
desc = (struct iwx_rx_mpdu_desc *)pktdata;
if (!(desc->status & htole16(IWX_RX_MPDU_RES_STATUS_CRC_OK)) ||
- !(desc->status & htole16(IWX_RX_MPDU_RES_STATUS_OVERRUN_OK)))
+ !(desc->status & htole16(IWX_RX_MPDU_RES_STATUS_OVERRUN_OK))) {
+ m_freem(m);
return; /* drop */
+ }
len = le16toh(desc->mpdu_len);
if (len < IEEE80211_MIN_LEN) {
ic->ic_stats.is_rx_tooshort++;
IC2IFP(ic)->if_ierrors++;
+ m_freem(m);
return;
}
if (len > maxlen - sizeof(*desc)) {
IC2IFP(ic)->if_ierrors++;
+ m_freem(m);
return;
}
@@ -6983,6 +6987,8 @@ iwx_rx_pkt(struct iwx_softc *sc, struct iwx_rx_data *data, struct mbuf_list *ml)
m = m_copym(m0, 0, M_COPYALL, M_DONTWAIT);
if (m == NULL) {
ifp->if_ierrors++;
+ m_freem(m0);
+ m0 = NULL;
break;
}
m_adj(m, offset);