iwlwifi: fix possible NULL dereference in iwl_set_rate()
authorSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 19 Nov 2007 07:59:08 +0000 (23:59 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 30 Nov 2007 02:34:51 +0000 (21:34 -0500)
Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/iwlwifi/iwl4965-base.c

index 465da4f67ce73d0fcfb9b1b9c7440d1b131dd2af..5751c89857f0d14a6ec9276c6e664bf6e1b97aa9 100644 (file)
@@ -2915,6 +2915,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
        int i;
 
        hw = iwl_get_hw_mode(priv, priv->phymode);
+       if (!hw) {
+               IWL_ERROR("Failed to set rate: unable to get hw mode\n");
+               return;
+       }
 
        priv->active_rate = 0;
        priv->active_rate_basic = 0;
index 9918780f5e866fe8286fb85c970b815c981b4968..0b22e01735765df43f174faeee720368b0c8405c 100644 (file)
@@ -3003,6 +3003,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
        int i;
 
        hw = iwl_get_hw_mode(priv, priv->phymode);
+       if (!hw) {
+               IWL_ERROR("Failed to set rate: unable to get hw mode\n");
+               return;
+       }
 
        priv->active_rate = 0;
        priv->active_rate_basic = 0;