Skip to content

Commit f58691d

Browse files
wifi: mwifiex: Fix oob check condition in mwifiex_process_rx_packet
jira VULN-154525 cve-bf CVE-2023-53226 commit-author Pin-yen Lin <[email protected]> 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 <[email protected]> Acked-by: Brian Norris <[email protected]> Reviewed-by: Matthew Wang <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit aef7a03) Signed-off-by: Shreeya Patel <[email protected]>
1 parent 5e35f54 commit f58691d

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
@@ -86,20 +86,22 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv,
8686
rx_pkt_len = le16_to_cpu(local_rx_pd->rx_pkt_length);
8787
rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_off;
8888

89-
if (sizeof(*rx_pkt_hdr) + rx_pkt_off > skb->len) {
89+
if (sizeof(rx_pkt_hdr->eth803_hdr) + sizeof(rfc1042_header) +
90+
rx_pkt_off > skb->len) {
9091
mwifiex_dbg(priv->adapter, ERROR,
9192
"wrong rx packet offset: len=%d, rx_pkt_off=%d\n",
9293
skb->len, rx_pkt_off);
9394
priv->stats.rx_dropped++;
9495
dev_kfree_skb_any(skb);
9596
}
9697

97-
if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
98-
sizeof(bridge_tunnel_header))) ||
99-
(!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
100-
sizeof(rfc1042_header)) &&
101-
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
102-
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX)) {
98+
if (sizeof(*rx_pkt_hdr) + rx_pkt_off <= skb->len &&
99+
((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
100+
sizeof(bridge_tunnel_header))) ||
101+
(!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
102+
sizeof(rfc1042_header)) &&
103+
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
104+
ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX))) {
103105
/*
104106
* Replace the 803 header and rfc1042 header (llc/snap) with an
105107
* EthernetII header, keep the src/dst and snap_type

0 commit comments

Comments
 (0)