>From 78b5e60d9797583172d3e1f755a9f354b5a20759 Mon Sep 17 00:00:00 2001 From: Joshua Roys <Joshua.Roys@xxxxxxxxxxxxxxx> Date: Thu, 3 May 2012 00:16:39 -0400 Subject: [PATCH 6/9] rtlwifi: add short circuit in the receive path Allow things like C2H events without any actual 802.11 data to avoid the rest of the receive path. Signed-off-by: Joshua Roys <Joshua.Roys@xxxxxxxxxxxxxxx> --- drivers/net/wireless/rtlwifi/usb.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 88dbef0..00e90bc 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c @@ -440,7 +440,11 @@ static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw, }; skb_pull(skb, RTL_RX_DESC_SIZE); - rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb); + if (!rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, + skb)) { + dev_kfree_skb_any(skb); + return; + } skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift)); hdr = (struct ieee80211_hdr *)(skb->data); fc = hdr->frame_control; @@ -483,7 +487,11 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw, }; skb_pull(skb, RTL_RX_DESC_SIZE); - rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb); + if (!rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, + skb)) { + dev_kfree_skb_any(skb); + return; + } skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift)); hdr = (struct ieee80211_hdr *)(skb->data); fc = hdr->frame_control; -- 1.7.7.6