iwlwifi: mvm: fix NVM parsing error path
authorJohannes Berg <johannes.berg@intel.com>
Mon, 13 May 2013 19:44:42 +0000 (21:44 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 16 May 2013 21:13:45 +0000 (23:13 +0200)
If NVM parsing fails and returns NULL, we continue in
the code flow and eventually crash accessing the NULL
pointer. Return an error from iwl_nvm_init() if the
parsing failed.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/nvm.c

index b8ec02f..c6c15f2 100644 (file)
@@ -231,8 +231,9 @@ int iwl_nvm_init(struct iwl_mvm *mvm)
        if (ret < 0)
                return ret;
 
-       ret = 0;
        mvm->nvm_data = iwl_parse_nvm_sections(mvm);
+       if (!mvm->nvm_data)
+               return -ENODATA;
 
-       return ret;
+       return 0;
 }