Skip to content

Commit 7343d5b

Browse files
committed
wifi: mwifiex: Fix oob check condition in mwifiex_process_rx_packet
jira VULN-169489 cve CVE-2023-52525 commit-author Pin-yen Lin <treapking@chromium.org> commit aef7a03 Only skip the code path trying to access the rfc1042 headers when the buffer is too small, so the driver can still process packets without rfc1042 headers. Fixes: 1195852 ("wifi: mwifiex: Fix OOB and integer underflow when rx packets") Signed-off-by: Pin-yen Lin <treapking@chromium.org> Acked-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Matthew Wang <matthewmwang@chromium.org> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230908104308.1546501-1-treapking@chromium.org (cherry picked from commit aef7a03) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 1ba5da6 commit 7343d5b

File tree

1 file changed

+9
-7
lines changed
  • drivers/net/wireless/marvell/mwifiex

1 file changed

+9
-7
lines changed

drivers/net/wireless/marvell/mwifiex/sta_rx.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,22 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv,
9898
rx_pkt_len = le16_to_cpu(local_rx_pd->rx_pkt_length);
9999
rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_off;
100100

101-
if (sizeof(*rx_pkt_hdr) + rx_pkt_off > skb->len) {
101+
if (sizeof(rx_pkt_hdr->eth803_hdr) + sizeof(rfc1042_header) +
102+
rx_pkt_off > skb->len) {
102103
mwifiex_dbg(priv->adapter, ERROR,
103104
"wrong rx packet offset: len=%d, rx_pkt_off=%d\n",
104105
skb->len, rx_pkt_off);
105106
priv->stats.rx_dropped++;
106107
dev_kfree_skb_any(skb);
107108
}
108109

109-
if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
110-
sizeof(bridge_tunnel_header))) ||
111-
(!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
112-
sizeof(rfc1042_header)) &&
113-
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
114-
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX)) {
110+
if (sizeof(*rx_pkt_hdr) + rx_pkt_off <= skb->len &&
111+
((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
112+
sizeof(bridge_tunnel_header))) ||
113+
(!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
114+
sizeof(rfc1042_header)) &&
115+
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
116+
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX))) {
115117
/*
116118
* Replace the 803 header and rfc1042 header (llc/snap) with an
117119
* EthernetII header, keep the src/dst and snap_type

0 commit comments

Comments
 (0)