From 1c04a7bb2999ac7648328a61069f231a4570698d Mon Sep 17 00:00:00 2001 From: Ahmad Masri Date: Tue, 17 Dec 2019 17:00:45 +0200 Subject: [PATCH 1/2] wil6210: add policy for all vendor commands Kernel 5.3.0 and later checks that all vendor commands registered with the device has a policy. add relevant policies for all commands. Change-Id: I4a24618d10f17cd61b8f6e4b149a5494b0af9639 Signed-off-by: Ahmad Masri --- drivers/net/wireless/ath/wil6210/cfg80211.c | 10 +++++++++- drivers/net/wireless/ath/wil6210/ftm.c | 4 ++-- drivers/net/wireless/ath/wil6210/ftm.h | 5 ++++- drivers/net/wireless/ath/wil6210/wil6210.h | 3 ++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 92d1fcdad680..3c3844877c87 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: ISC /* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include @@ -362,6 +362,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LOC_GET_CAPA, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, + .policy = VENDOR_CMD_RAW_DATA, .doit = wil_ftm_get_capabilities }, { @@ -369,6 +370,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_START_SESSION, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, + .policy = wil_nl80211_loc_policy, .doit = wil_ftm_start_session }, { @@ -376,6 +378,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_ABORT_SESSION, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, + .policy = VENDOR_CMD_RAW_DATA, .doit = wil_ftm_abort_session }, { @@ -383,6 +386,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_CFG_RESPONDER, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, + .policy = VENDOR_CMD_RAW_DATA, .doit = wil_ftm_configure_responder }, { @@ -390,6 +394,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, + .policy = wil_nl80211_loc_policy, .doit = wil_aoa_start_measurement }, { @@ -397,6 +402,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_ABORT_MEAS, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, + .policy = VENDOR_CMD_RAW_DATA, .doit = wil_aoa_abort_measurement }, { @@ -438,6 +444,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_BRP_SET_ANT_LIMIT, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, + .policy = wil_brp_ant_limit_policy, .doit = wil_brp_set_ant_limit }, { @@ -445,6 +452,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_UNSPEC, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, + .policy = wil_nl_60g_policy, .doit = wil_nl_60g_handle_cmd }, }; diff --git a/drivers/net/wireless/ath/wil6210/ftm.c b/drivers/net/wireless/ath/wil6210/ftm.c index 58d49043a25b..8b799a8fd783 100644 --- a/drivers/net/wireless/ath/wil6210/ftm.c +++ b/drivers/net/wireless/ath/wil6210/ftm.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: ISC -/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. */ +/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #include #include @@ -36,7 +36,7 @@ enum qca_attr_loc_reuse { QCA_ATTR_PAD = 13, }; -static const struct +const struct nla_policy wil_nl80211_loc_policy[QCA_ATTR_LOC_MAX + 1] = { [QCA_ATTR_FTM_SESSION_COOKIE] = { .type = NLA_U64 }, [QCA_ATTR_LOC_CAPA] = { .type = NLA_NESTED }, diff --git a/drivers/net/wireless/ath/wil6210/ftm.h b/drivers/net/wireless/ath/wil6210/ftm.h index cb4a0c8f9890..01b8efe877c0 100644 --- a/drivers/net/wireless/ath/wil6210/ftm.h +++ b/drivers/net/wireless/ath/wil6210/ftm.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: ISC */ -/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. */ +/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #ifndef __WIL6210_FTM_H__ #define __WIL6210_FTM_H__ @@ -491,6 +491,9 @@ struct wil_ftm_priv { struct work_struct aoa_timeout_work; }; +extern const struct +nla_policy wil_nl80211_loc_policy[]; + int wil_ftm_get_capabilities(struct wiphy *wiphy, struct wireless_dev *wdev, const void *data, int data_len); int wil_ftm_start_session(struct wiphy *wiphy, struct wireless_dev *wdev, diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 9deeb3dec992..5278a4c3c630 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: ISC */ /* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef __WIL6210_H__ @@ -14,6 +14,7 @@ #include #include #include +#include #include "wmi.h" #include "wil_platform.h" #include "ftm.h" From 083e86574ef414c2fcb288217b5c19b9ff5436e8 Mon Sep 17 00:00:00 2001 From: Ahmad Masri Date: Wed, 8 Jan 2020 19:31:09 +0200 Subject: [PATCH 2/2] wil6210: fix vendor command policy for vendor unspec commands change the policy field in the vendor commands for QCA_NL80211_VENDOR_SUBCMD_UNSPEC to be VENDOR_CMD_RAW_DATA. This is a workaround for kernel 5.4 policy checks. A complete solution for all vendor command policies will be submitted later. Change-Id: I889c86984a4835fed9bd96d487641fc5f4081faf Signed-off-by: Ahmad Masri --- drivers/net/wireless/ath/wil6210/cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 3c3844877c87..7f7bd838ce89 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -452,7 +452,7 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_UNSPEC, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - .policy = wil_nl_60g_policy, + .policy = VENDOR_CMD_RAW_DATA, .doit = wil_nl_60g_handle_cmd }, };