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

Commit 508e32e1 authored by Reinette Chatre's avatar Reinette Chatre Committed by John W. Linville
Browse files

iwlwifi: perform bss_info_changed post association work right away



Do not use workqueue for bss_info_changed post association work.
When driver is notified of association the upper layer will be notified
right after that the association is complete. Doing the post association
work in a workqueue introduces a race condition where the upper layer may
want to make use of the association, but it is not yet complete.

Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Acked-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent eadd3c4b
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -1840,7 +1840,7 @@ static void iwl4965_set_flags_for_phymode(struct iwl_priv *priv,
		      | RXON_FLG_CCK_MSK);
		priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
	} else {
		/* Copied from iwl4965_bg_post_associate() */
		/* Copied from iwl4965_post_associate() */
		if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
			priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
		else
@@ -6004,10 +6004,8 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data)

#define IWL_DELAY_NEXT_SCAN (HZ*2)

static void iwl4965_bg_post_associate(struct work_struct *data)
static void iwl4965_post_associate(struct iwl_priv *priv)
{
	struct iwl_priv *priv = container_of(data, struct iwl_priv,
					     post_associate.work);
	struct ieee80211_conf *conf = NULL;
	int ret = 0;
	DECLARE_MAC_BUF(mac);
@@ -6025,12 +6023,10 @@ static void iwl4965_bg_post_associate(struct work_struct *data)
	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
		return;

	mutex_lock(&priv->mutex);

	if (!priv->vif || !priv->is_open) {
		mutex_unlock(&priv->mutex);
	if (!priv->vif || !priv->is_open)
		return;
	}

	iwl4965_scan_cancel_timeout(priv, 200);

	conf = ieee80211_get_hw_conf(priv->hw);
@@ -6114,7 +6110,18 @@ static void iwl4965_bg_post_associate(struct work_struct *data)

	/* we have just associated, don't start scan too early */
	priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
}


static void iwl4965_bg_post_associate(struct work_struct *data)
{
	struct iwl_priv *priv = container_of(data, struct iwl_priv,
					     post_associate.work);

	mutex_lock(&priv->mutex);
	iwl4965_post_associate(priv);
	mutex_unlock(&priv->mutex);

}

static void iwl4965_bg_abort_scan(struct work_struct *work)
@@ -6736,6 +6743,10 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,

	if (changes & BSS_CHANGED_ASSOC) {
		IWL_DEBUG_MAC80211("ASSOC %d\n", bss_conf->assoc);
		/* This should never happen as this function should
		 * never be called from interrupt context. */
		if (WARN_ON_ONCE(in_interrupt()))
			return;
		if (bss_conf->assoc) {
			priv->assoc_id = bss_conf->aid;
			priv->beacon_int = bss_conf->beacon_int;
@@ -6743,7 +6754,9 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
			priv->assoc_capability = bss_conf->assoc_capability;
			priv->next_scan_jiffies = jiffies +
					IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
			queue_work(priv->workqueue, &priv->post_associate.work);
			mutex_lock(&priv->mutex);
			iwl4965_post_associate(priv);
			mutex_unlock(&priv->mutex);
		} else {
			priv->assoc_id = 0;
			IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);