Commit 9cd1d3eb2653603b924d33129469697d4a55d179

Authored by Larry Finger
Committed by Greg Kroah-Hartman
1 parent 9297b375ec

rtlwifi: rtl8192ce: Fix kernel crashes due to missing callback entry

commit f892914c03131a445b926b82815b03162c19288e upstream.

In the major update of the rtlwifi-family of drivers, one of the callback entries
was missed, which leads to memory corruption. Unfortunately, this corruption
never caused a kernel oops, but showed up in other parts of the system.
This patch is one of three needed to fix the kernel regression reported at
https://bugzilla.kernel.org/show_bug.cgi?id=88951.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Catalin Iacob <iacobcatalin@gmail.com>
Tested-by: Catalin Iacob <iacobcatalin@gmail.com>
Cc: Catalin Iacob <iacobcatalin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 3 changed files with 22 additions and 0 deletions Side-by-side Diff

drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
... ... @@ -228,6 +228,7 @@
228 228 .led_control = rtl92ce_led_control,
229 229 .set_desc = rtl92ce_set_desc,
230 230 .get_desc = rtl92ce_get_desc,
  231 + .is_tx_desc_closed = rtl92ce_is_tx_desc_closed,
231 232 .tx_polling = rtl92ce_tx_polling,
232 233 .enable_hw_sec = rtl92ce_enable_hw_security_config,
233 234 .set_key = rtl92ce_set_key,
... ... @@ -271,6 +272,8 @@
271 272 .maps[MAC_RCR_ACRC32] = ACRC32,
272 273 .maps[MAC_RCR_ACF] = ACF,
273 274 .maps[MAC_RCR_AAP] = AAP,
  275 + .maps[MAC_HIMR] = REG_HIMR,
  276 + .maps[MAC_HIMRE] = REG_HIMRE,
274 277  
275 278 .maps[EFUSE_TEST] = REG_EFUSE_TEST,
276 279 .maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
... ... @@ -739,6 +739,23 @@
739 739 return ret;
740 740 }
741 741  
  742 +bool rtl92ce_is_tx_desc_closed(struct ieee80211_hw *hw,
  743 + u8 hw_queue, u16 index)
  744 +{
  745 + struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
  746 + struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
  747 + u8 *entry = (u8 *)(&ring->desc[ring->idx]);
  748 + u8 own = (u8)rtl92ce_get_desc(entry, true, HW_DESC_OWN);
  749 +
  750 + /*beacon packet will only use the first
  751 + *descriptor defautly,and the own may not
  752 + *be cleared by the hardware
  753 + */
  754 + if (own)
  755 + return false;
  756 + return true;
  757 +}
  758 +
742 759 void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue)
743 760 {
744 761 struct rtl_priv *rtlpriv = rtl_priv(hw);
drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
... ... @@ -723,6 +723,8 @@
723 723 void rtl92ce_set_desc(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
724 724 u8 desc_name, u8 *val);
725 725 u32 rtl92ce_get_desc(u8 *pdesc, bool istx, u8 desc_name);
  726 +bool rtl92ce_is_tx_desc_closed(struct ieee80211_hw *hw,
  727 + u8 hw_queue, u16 index);
726 728 void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue);
727 729 void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
728 730 bool b_firstseg, bool b_lastseg,