Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebecdcc1 authored by Larry Finger's avatar Larry Finger Committed by John W. Linville
Browse files

rtlwifi: rtl8192c: Prevent sleeping from invalid context in rtl8192cu

When driver rtl8192cu is used with the debug level set to 3 or greater,
the result is "sleeping function called from invalid context" due to
an rcu_read_lock() call in the DM refresh routine in driver rtl8192c.
This lock is not necessary as the USB driver does not use the struct
being protected, thus the lock is set only when a PCI interface is
active.

This bug is reported in https://bugzilla.kernel.org/show_bug.cgi?id=42775

.

Reported-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
Tested-by: default avatarRonald Wahl <ronald.wahl@raritan.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Cc: Ronald Wahl <ronald.wahl@raritan.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8f526ab4
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -1201,12 +1201,17 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
				 "PreState = %d, CurState = %d\n",
				 "PreState = %d, CurState = %d\n",
				 p_ra->pre_ratr_state, p_ra->ratr_state);
				 p_ra->pre_ratr_state, p_ra->ratr_state);


			/* Only the PCI card uses sta in the update rate table
			 * callback routine */
			if (rtlhal->interface == INTF_PCI) {
				rcu_read_lock();
				rcu_read_lock();
				sta = ieee80211_find_sta(mac->vif, mac->bssid);
				sta = ieee80211_find_sta(mac->vif, mac->bssid);
			}
			rtlpriv->cfg->ops->update_rate_tbl(hw, sta,
			rtlpriv->cfg->ops->update_rate_tbl(hw, sta,
					p_ra->ratr_state);
					p_ra->ratr_state);


			p_ra->pre_ratr_state = p_ra->ratr_state;
			p_ra->pre_ratr_state = p_ra->ratr_state;
			if (rtlhal->interface == INTF_PCI)
				rcu_read_unlock();
				rcu_read_unlock();
		}
		}
	}
	}