Skip to content

Commit 6d61ce6

Browse files
lfdominguezgregkh
authored andcommitted
rtlwifi: Fix NULL dereference when PCI driver used as an AP
commit 7c62940 upstream. In commit 33511b1 ("rtlwifi: add support to send beacon frame"), the mechanism for sending beacons was established. That patch works correctly for rtl8192cu, but there is a possibility of getting the following warnings in the PCI drivers: WARNING: CPU: 1 PID: 2439 at net/mac80211/driver-ops.h:12 ieee80211_bss_info_change_notify+0x179/0x1d0 [mac80211]() wlp5s0: Failed check-sdata-in-driver check, flags: 0x0 The warning is followed by a NULL pointer dereference as follows: BUG: unable to handle kernel NULL pointer dereference at 0000000000000006 IP: [<ffffffffc073998e>] rtl_get_tcb_desc+0x5e/0x760 [rtlwifi] This problem was reported at http://thread.gmane.org/gmane.linux.kernel.wireless.general/138645, but no solution was found at that time. The problem was also reported at https://bugzilla.kernel.org/show_bug.cgi?id=9744 and this solution was developed and tested there. The USB driver works with a NULL final argument in the adapter_tx() callback; however, the PCI drivers need a struct rtl_tcb_desc in that position. Fixes: 33511b1 ("rtlwifi: add support to send beacon frame.") Signed-off-by: Luis Felipe Dominguez Vega <[email protected]> Signed-off-by: Larry Finger <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c9557ae commit 6d61ce6

File tree

1 file changed

+5
-2
lines changed
  • drivers/net/wireless/rtlwifi

1 file changed

+5
-2
lines changed

drivers/net/wireless/rtlwifi/core.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,9 +1015,12 @@ static void send_beacon_frame(struct ieee80211_hw *hw,
10151015
{
10161016
struct rtl_priv *rtlpriv = rtl_priv(hw);
10171017
struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
1018+
struct rtl_tcb_desc tcb_desc;
10181019

1019-
if (skb)
1020-
rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
1020+
if (skb) {
1021+
memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
1022+
rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc);
1023+
}
10211024
}
10221025

10231026
static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,

0 commit comments

Comments
 (0)