Browse Source

iwlwifi: mvm: sanity check context in iwl_mvm_phy_ctxt_unref()

In some botched (!) restart scenarios we seem to get here with
a NULL PHY context, so warn and exit instead of crashing.

Reported-by: Omer Kremer <omerx.kremer@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg 12 years ago
parent
commit
e28210115b
1 changed files with 4 additions and 0 deletions
  1. 4 0
      drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c

+ 4 - 0
drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c

@@ -245,5 +245,9 @@ int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
 void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
 {
 	lockdep_assert_held(&mvm->mutex);
+
+	if (WARN_ON_ONCE(!ctxt))
+		return;
+
 	ctxt->ref--;
 }