iwlwifi: mvm: Improve debugfs tof robustness
authorAssaf Krauss <assaf.krauss@intel.com>
Wed, 16 Sep 2015 08:47:14 +0000 (11:47 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Mon, 5 Oct 2015 11:33:25 +0000 (14:33 +0300)
Return a proper error when wrong parameters are passed to debugfs
tof_range_request.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c

index 15ab543f7156fa9de5ce7b3558a82cef1de69dae..5dc1686100d2b12dc5963e53246f76f665d7820e 100644 (file)
@@ -892,6 +892,7 @@ static ssize_t iwl_dbgfs_tof_range_request_write(struct ieee80211_vif *vif,
                        goto out;
                }
                memcpy(mvm->tof_data.range_req.macaddr_template, mac, ETH_ALEN);
+               goto out;
        }
 
        data = iwl_dbgfs_is_match("macaddr_mask=", buf);
@@ -903,11 +904,12 @@ static ssize_t iwl_dbgfs_tof_range_request_write(struct ieee80211_vif *vif,
                        goto out;
                }
                memcpy(mvm->tof_data.range_req.macaddr_mask, mac, ETH_ALEN);
+               goto out;
        }
 
        data = iwl_dbgfs_is_match("ap=", buf);
        if (data) {
-               struct iwl_tof_range_req_ap_entry ap;
+               struct iwl_tof_range_req_ap_entry ap = {};
                int size = sizeof(struct iwl_tof_range_req_ap_entry);
                u16 burst_period;
                u8 *mac = ap.bssid;
@@ -944,12 +946,12 @@ static ssize_t iwl_dbgfs_tof_range_request_write(struct ieee80211_vif *vif,
        data = iwl_dbgfs_is_match("send_range_request=", buf);
        if (data) {
                ret = kstrtou32(data, 10, &value);
-               if (ret == 0 && value) {
+               if (ret == 0 && value)
                        ret = iwl_mvm_tof_range_request_cmd(mvm, vif);
-                       goto out;
-               }
+               goto out;
        }
 
+       ret = -EINVAL;
 out:
        mutex_unlock(&mvm->mutex);
        return ret ?: count;
@@ -1073,12 +1075,12 @@ static ssize_t iwl_dbgfs_tof_range_req_ext_write(struct ieee80211_vif *vif,
        data = iwl_dbgfs_is_match("send_range_req_ext=", buf);
        if (data) {
                ret = kstrtou32(data, 10, &value);
-               if (ret == 0 && value) {
+               if (ret == 0 && value)
                        ret = iwl_mvm_tof_range_request_ext_cmd(mvm, vif);
-                       goto out;
-               }
+               goto out;
        }
 
+       ret = -EINVAL;
 out:
        mutex_unlock(&mvm->mutex);
        return ret ?: count;