qcacld-3.0: Check FTM mode in vendor cmds handlers

Vendor commands of wiphy aren't initialized when driver load as FTM mode,
if changed to mission mode later with following cli:
echo 0 > /sys/module/wlan/parameters/con_mode,
vendor commands of wiphy keep uninitialized, wpa supplicant can't get
roam offload status by QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES,
so PMK isn't sent to driver/firmware,  roam offload failed.

To fix it, remove QDF_GLOBAL_FTM_MODE check in wlan_hdd_cfg80211_init, let
vendor commands of wiphy initialized in FTM mode too when driver load.
But in each vendor cmd, check FTM mode when called, if FTM mode, return
-EPERM.
When driver is changed to mission mode, all interfaces are deleted and
re-added by driver, when interface added event is received by
wpa supplicant,  QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES is
called again to get roam offload enabled status, PMK will be sent to
driver and firmware when RSO start, roam offload will work.

Change-Id: Ie0c868ebd4b7e356d72a154206b13df94f378188
CRs-Fixed: 3213221
This commit is contained in:
Jianmin Zhu 2022-06-05 10:20:50 +08:00
commit 5862891f8c
15 changed files with 172 additions and 8 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -166,6 +167,11 @@ __wlan_hdd_cfg80211_set_limit_offchan_param(struct wiphy *wiphy,
hdd_enter();
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret < 0)
return ret;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -321,6 +322,11 @@ static int __wlan_hdd_cfg80211_bcn_rcv_op(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
errno = hdd_validate_adapter(adapter);
if (errno)
return errno;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -141,6 +142,11 @@ static int __wlan_hdd_cfg80211_set_btc_chain_mode(struct wiphy *wiphy,
hdd_enter_dev(wdev->netdev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
errno = wlan_hdd_validate_context(hdd_ctx);
if (errno != 0)
return errno;

View file

@ -6011,6 +6011,11 @@ static int __wlan_hdd_cfg80211_disable_dfs_chan_scan(struct wiphy *wiphy,
bool enable_dfs_scan = true;
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret_val = wlan_hdd_validate_context(hdd_ctx);
if (ret_val)
return ret_val;
@ -11390,6 +11395,11 @@ __wlan_hdd_cfg80211_set_ns_offload(struct wiphy *wiphy,
hdd_enter_dev(wdev->netdev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status)
return status;
@ -11574,6 +11584,11 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
hdd_enter_dev(wdev->netdev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return -EINVAL;
@ -11769,6 +11784,11 @@ static int __wlan_hdd_cfg80211_set_probable_oper_channel(struct wiphy *wiphy,
hdd_enter_dev(ndev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;
@ -12854,6 +12874,11 @@ static int __wlan_hdd_cfg80211_setband(struct wiphy *wiphy,
hdd_enter();
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;
@ -13548,6 +13573,11 @@ static int __wlan_hdd_cfg80211_getband(struct wiphy *wiphy,
hdd_enter();
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;
@ -15289,6 +15319,11 @@ static int __wlan_hdd_cfg80211_get_usable_channel(struct wiphy *wiphy,
uint32_t count = 0;
QDF_STATUS status;
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return ret;
@ -15411,6 +15446,11 @@ static int __wlan_hdd_cfg80211_set_roam_events(struct wiphy *wiphy,
int ret;
uint8_t config, state, param = 0;
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret != 0) {
hdd_err("Invalid hdd_ctx");
@ -15542,6 +15582,11 @@ static int __wlan_hdd_cfg80211_get_chain_rssi(struct wiphy *wiphy,
hdd_enter();
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
retval = wlan_hdd_validate_context(hdd_ctx);
if (0 != retval)
return retval;
@ -17165,15 +17210,11 @@ int wlan_hdd_cfg80211_init(struct device *dev,
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wiphy->max_remain_on_channel_duration = MAX_REMAIN_ON_CHANNEL_DURATION;
if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) {
wiphy->n_vendor_commands =
ARRAY_SIZE(hdd_wiphy_vendor_commands);
wiphy->vendor_commands = hdd_wiphy_vendor_commands;
wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands);
wiphy->vendor_commands = hdd_wiphy_vendor_commands;
wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events;
wiphy->n_vendor_events =
ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events);
}
wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events;
wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events);
#ifdef QCA_HT_2040_COEX
wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -74,6 +75,11 @@ static int __wlan_hdd_cfg80211_set_coex_config(struct wiphy *wiphy,
hdd_enter();
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
errno = wlan_hdd_validate_context(hdd_ctx);
if (errno != 0)
return errno;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -437,6 +438,11 @@ static int __wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -780,6 +781,11 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (wlan_hdd_validate_context(hdd_ctx))
return -EINVAL;
@ -980,6 +986,11 @@ static int __wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (wlan_hdd_validate_context(hdd_ctx))
return -EINVAL;
@ -1106,6 +1117,11 @@ __wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (wlan_hdd_validate_context(hdd_ctx))
return -EINVAL;
@ -1235,6 +1251,11 @@ __wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (wlan_hdd_validate_context(hdd_ctx))
return -EINVAL;
@ -1428,6 +1449,11 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
rc = wlan_hdd_validate_context(hdd_ctx);
if (rc)
return rc;
@ -1664,6 +1690,11 @@ static int __wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
rc = wlan_hdd_validate_context(hdd_ctx);
if (rc)
return rc;
@ -1812,6 +1843,11 @@ static int __wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (wlan_hdd_validate_context(hdd_ctx))
return -EINVAL;
@ -1955,6 +1991,11 @@ static int __wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
rc = wlan_hdd_validate_context(hdd_ctx);
if (rc)
return rc;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -1253,6 +1254,11 @@ __wlan_hdd_cfg80211_oem_data_handler(struct wiphy *wiphy,
.dealloc = wlan_hdd_free_oem_data,
};
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -77,6 +78,11 @@ __wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (wlan_hdd_validate_vdev_id(adapter->vdev_id))
return -EINVAL;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -970,6 +971,11 @@ static int __wlan_hdd_cfg80211_vendor_scan(struct wiphy *wiphy,
hdd_enter_dev(wdev->netdev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret) {
/*

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -80,6 +81,11 @@ static int __wlan_hdd_cfg80211_set_gateway_params(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return ret;

View file

@ -2455,6 +2455,11 @@ static int __wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy,
hdd_enter_dev(wdev->netdev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
status = wlan_hdd_validate_context(hdd_ctx);
if (0 != status)
return -EINVAL;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -63,6 +64,11 @@ static int __wlan_hdd_cfg80211_txpower_scale(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;
@ -147,6 +153,11 @@ __wlan_hdd_cfg80211_txpower_scale_decr_db(struct wiphy *wiphy,
hdd_enter_dev(dev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -2835,6 +2836,11 @@ static int __wlan_hdd_cfg80211_config_tspec(struct wiphy *wiphy,
hdd_enter_dev(wdev->netdev);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret != 0)
return ret;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -182,6 +183,11 @@ __wlan_cfg80211_set_interop_issues_ap_config(struct wiphy *wiphy,
struct wlan_objmgr_vdev *vdev;
vdev = hdd_objmgr_get_vdev(adapter);
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
if (!vdev) {
osif_err("Invalid vdev");
return -EINVAL;