From: Johannes Berg Date: Wed, 8 May 2013 13:55:31 +0000 (+0200) Subject: iwlwifi: mvm: sanity check context in iwl_mvm_phy_ctxt_unref() X-Git-Tag: v5.15~19707^2~103^2^2~5^2~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e28210115b0ff3544b39ee67d8e48dc74b25b6b8;p=platform%2Fkernel%2Flinux-starfive.git 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 Reviewed-by: Ilan Peer Reviewed-by: Emmanuel Grumbach Signed-off-by: Johannes Berg --- diff --git a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c index 0ea61aa..1b4db25 100644 --- a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +++ b/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--; }