[kernel/f16] iwl{wifi, legacy}: Fix warnings on remove interface from Stanislaw Gruszka (rhbz 770467)

Josh Boyer jwboyer at fedoraproject.org
Thu Mar 29 14:42:13 UTC 2012


commit 44e6a69b2a5a7cfb8251561c2bfb2d3057eaded9
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Wed Mar 28 11:56:33 2012 -0400

    iwl{wifi,legacy}: Fix warnings on remove interface from Stanislaw Gruszka
      (rhbz 770467)

 iwlegacy-do-not-nulify-il-vif-on-reset.patch |   77 ++++++++++++++++++++++++++
 iwlwifi-do-not-nulify-ctx-vif-on-reset.patch |   66 ++++++++++++++++++++++
 kernel.spec                                  |   12 ++++
 3 files changed, 155 insertions(+), 0 deletions(-)
---
diff --git a/iwlegacy-do-not-nulify-il-vif-on-reset.patch b/iwlegacy-do-not-nulify-il-vif-on-reset.patch
new file mode 100644
index 0000000..d1913d7
--- /dev/null
+++ b/iwlegacy-do-not-nulify-il-vif-on-reset.patch
@@ -0,0 +1,77 @@
+This il->vif is dereferenced in different part of iwlegacy code, so do
+not nullify it. This should fix random crashes observed in companion
+with microcode errors i.e. crash in il3945_config_ap().
+
+Additionally this should address also
+WARNING: at drivers/net/wireless/iwlegacy/common.c:4656 il_mac_remove_interface
+at least one of the possible reasons of that warning.
+
+Cc: stable at vger.kernel.org
+Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>
+---
+ drivers/net/wireless/iwlegacy/3945-mac.c |    2 --
+ drivers/net/wireless/iwlegacy/4965-mac.c |    2 --
+ drivers/net/wireless/iwlegacy/common.c   |   15 ++++++++++++---
+ 3 files changed, 12 insertions(+), 7 deletions(-)
+
+--- linux-3.3.noarch.orig/drivers/net/wireless/iwlegacy/3945-mac.c
++++ linux-3.3.noarch/drivers/net/wireless/iwlegacy/3945-mac.c
+@@ -2684,7 +2684,6 @@ il3945_bg_restart(struct work_struct *da
+ 
+ 	if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
+ 		mutex_lock(&il->mutex);
+-		il->ctx.vif = NULL;
+ 		il->is_open = 0;
+ 		mutex_unlock(&il->mutex);
+ 		il3945_down(il);
+--- linux-3.3.noarch.orig/drivers/net/wireless/iwlegacy/4965-mac.c
++++ linux-3.3.noarch/drivers/net/wireless/iwlegacy/4965-mac.c
+@@ -5381,7 +5381,6 @@ il4965_bg_restart(struct work_struct *da
+ 
+ 	if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
+ 		mutex_lock(&il->mutex);
+-		il->ctx.vif = NULL;
+ 		il->is_open = 0;
+ 
+ 		__il4965_down(il);
+--- linux-3.3.noarch.orig/drivers/net/wireless/iwlegacy/common.c
++++ linux-3.3.noarch/drivers/net/wireless/iwlegacy/common.c
+@@ -4575,6 +4575,7 @@ il_mac_add_interface(struct ieee80211_hw
+ 	struct il_priv *il = hw->priv;
+ 	struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
+ 	int err;
++	bool reset;
+ 	u32 modes;
+ 
+ 	D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr);
+@@ -4594,6 +4595,16 @@ il_mac_add_interface(struct ieee80211_hw
+ 		goto out;
+ 	}
+ 
++	/*
++	 * We do not support multiple virtual interfaces, but on hardware reset
++	 * we have to add the same interface again.
++	 */
++	reset = (il->ctx.vif == vif);
++	if (il->ctx.vif && !reset) {
++		err = -EOPNOTSUPP;
++		goto out;
++	}
++
+ 	modes = il->ctx.interface_modes | il->ctx.exclusive_interface_modes;
+ 	if (!(modes & BIT(vif->type))) {
+ 		err = -EOPNOTSUPP;
+@@ -4605,8 +4616,11 @@ il_mac_add_interface(struct ieee80211_hw
+ 
+ 	err = il_setup_interface(il, &il->ctx);
+ 	if (err) {
+-		il->ctx.vif = NULL;
+-		il->iw_mode = NL80211_IFTYPE_STATION;
++		IL_WARN("Fail to set mode %d\n", vif->type);
++		if (!reset) {
++			il->ctx.vif = NULL;
++			il->iw_mode = NL80211_IFTYPE_STATION;
++		}
+ 	}
+ 
+ out:
diff --git a/iwlwifi-do-not-nulify-ctx-vif-on-reset.patch b/iwlwifi-do-not-nulify-ctx-vif-on-reset.patch
new file mode 100644
index 0000000..e03f2d3
--- /dev/null
+++ b/iwlwifi-do-not-nulify-ctx-vif-on-reset.patch
@@ -0,0 +1,66 @@
+ctx->vif is dereferenced in different part of iwlwifi code, so do not
+nullify it.
+
+This should address at least one of the possible reasons of WARNING at
+iwlagn_mac_remove_interface, and perhaps some random crashes when
+firmware reset is performed.
+
+Cc: stable at vger.kernel.org
+Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>
+---
+ drivers/net/wireless/iwlwifi/iwl-agn.c      |    3 ---
+ drivers/net/wireless/iwlwifi/iwl-mac80211.c |   10 +++++++++-
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+--- linux-3.3.noarch.orig/drivers/net/wireless/iwlwifi/iwl-agn.c
++++ linux-3.3.noarch/drivers/net/wireless/iwlwifi/iwl-agn.c
+@@ -1403,7 +1403,6 @@ static void iwl_bg_run_time_calib_work(s
+ 
+ void iwlagn_prepare_restart(struct iwl_priv *priv)
+ {
+-	struct iwl_rxon_context *ctx;
+ 	bool bt_full_concurrent;
+ 	u8 bt_ci_compliance;
+ 	u8 bt_load;
+@@ -1412,8 +1411,6 @@ void iwlagn_prepare_restart(struct iwl_p
+ 
+ 	lockdep_assert_held(&priv->shrd->mutex);
+ 
+-	for_each_context(priv, ctx)
+-		ctx->vif = NULL;
+ 	priv->is_open = 0;
+ 
+ 	/*
+--- linux-3.3.noarch.orig/drivers/net/wireless/iwlwifi/iwl-mac80211.c
++++ linux-3.3.noarch/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+@@ -1226,6 +1226,7 @@ static int iwlagn_mac_add_interface(stru
+ 	struct iwl_rxon_context *tmp, *ctx = NULL;
+ 	int err;
+ 	enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif);
++	bool reset = false;
+ 
+ 	IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n",
+ 			   viftype, vif->addr);
+@@ -1247,6 +1248,13 @@ static int iwlagn_mac_add_interface(stru
+ 			tmp->interface_modes | tmp->exclusive_interface_modes;
+ 
+ 		if (tmp->vif) {
++			/* On reset we need to add the same interface again */
++			if (tmp->vif == vif) {
++				reset = true;
++				ctx = tmp;
++				break;
++			}
++
+ 			/* check if this busy context is exclusive */
+ 			if (tmp->exclusive_interface_modes &
+ 						BIT(tmp->vif->type)) {
+@@ -1273,7 +1281,7 @@ static int iwlagn_mac_add_interface(stru
+ 	ctx->vif = vif;
+ 
+ 	err = iwl_setup_interface(priv, ctx);
+-	if (!err)
++	if (!err || reset)
+ 		goto out;
+ 
+ 	ctx->vif = NULL;
diff --git a/kernel.spec b/kernel.spec
index f1f4c22..9ea0ec3 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -785,6 +785,10 @@ Patch21351: x86-add-io_apic_ops-to-allow-interception.patch
 Patch21352: x86-apic_ops-Replace-apic_ops-with-x86_apic_ops.patch
 Patch21353: xen-x86-Implement-x86_apic_ops.patch
 
+#rhbz 770476
+Patch21370: iwlegacy-do-not-nulify-il-vif-on-reset.patch
+Patch21371: iwlwifi-do-not-nulify-ctx-vif-on-reset.patch
+
 Patch21500: ASPM-Fix-pcie-devs-with-non-pcie-children.patch
 
 Patch22000: weird-root-dentry-name-debug.patch
@@ -1459,6 +1463,10 @@ ApplyPatch x86-add-io_apic_ops-to-allow-interception.patch
 ApplyPatch x86-apic_ops-Replace-apic_ops-with-x86_apic_ops.patch
 ApplyPatch xen-x86-Implement-x86_apic_ops.patch
 
+#rhbz 770476
+ApplyPatch iwlegacy-do-not-nulify-il-vif-on-reset.patch
+ApplyPatch iwlwifi-do-not-nulify-ctx-vif-on-reset.patch
+
 #rhbz 803809 CVE-2012-1179
 ApplyPatch mm-thp-fix-pmd_bad-triggering.patch
 
@@ -2202,6 +2210,10 @@ fi
 # and build.
 
 %changelog
+* Thu Mar 29 2012 Josh Boyer <jwboyer at redhat.com>
+- iwl{wifi,legacy}: Fix warnings on remove interface from Stanislaw Gruszka
+  (rhbz 770467)
+
 * Wed Mar 28 2012 Josh Boyer <jwboyer at redhat.com>
 - Fix disabled ASPM regression
 


More information about the scm-commits mailing list