fix: prevent monitor RX null dereference

Do not send monitor frames through the normal data path when simultaneous monitor/data support is disabled. Handle monitor skb allocation failures without dereferencing NULL or dropping the original combined-mode frame.

Fixes #83
This commit is contained in:
Shen Mintao
2026-08-07 16:12:28 +08:00
parent 40f00e69af
commit 531d16c4d6
+19 -3
View File
@@ -2283,6 +2283,11 @@ u8 rwnx_rxdataind_aicwf(struct rwnx_hw *rwnx_hw, void *hostid, void *rx_priv)
if(hw_rxhdr->flags_upload) if(hw_rxhdr->flags_upload)
status |= RX_STAT_FORWARD; status |= RX_STAT_FORWARD;
#ifndef CONFIG_RWNX_MON_DATA
if (status & RX_STAT_MONITOR)
status &= ~RX_STAT_FORWARD;
#endif
/* Check if we need to delete the buffer */ /* Check if we need to delete the buffer */
if (status & RX_STAT_DELETE) { if (status & RX_STAT_DELETE) {
/* Remove the SK buffer from the rxbuf_elems table */ /* Remove the SK buffer from the rxbuf_elems table */
@@ -2345,13 +2350,24 @@ u8 rwnx_rxdataind_aicwf(struct rwnx_hw *rwnx_hw, void *hostid, void *rx_priv)
} else { } else {
#ifdef CONFIG_RWNX_MON_DATA #ifdef CONFIG_RWNX_MON_DATA
skb_monitor = skb_copy_expand(skb, rtap_len, 0, GFP_ATOMIC); skb_monitor = skb_copy_expand(skb, rtap_len, 0, GFP_ATOMIC);
skb_monitor->data += (msdu_offset + 2); //sdio/usb word allign if (skb_monitor) {
skb_monitor->data += (msdu_offset + 2); //sdio/usb word allign
//Save frame length //Save frame length
frm_len = le32_to_cpu(hw_rxhdr->hwvect.len); frm_len = le32_to_cpu(hw_rxhdr->hwvect.len);
}
#endif #endif
} }
if (!skb_monitor) {
if (status == RX_STAT_MONITOR) {
dev_kfree_skb(skb);
goto end;
}
goto check_len_update;
}
//skb_reset_tail_pointer(skb); //skb_reset_tail_pointer(skb);
//skb->len = 0; //skb->len = 0;
skb_reset_tail_pointer(skb_monitor); skb_reset_tail_pointer(skb_monitor);