diff options
author | Jaewan Kim <jaewan@google.com> | 2023-01-30 10:45:14 +0300 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2023-02-14 14:09:18 +0300 |
commit | 90b2c3cc4b718d7e5591e812313dd72677d9fad0 (patch) | |
tree | cea9424bf8adde03f6ad41c40acc2898fa9a25c0 | |
parent | 08b74776a8acb02b7cabb77fc1ccbd93e147edfa (diff) | |
download | linux-90b2c3cc4b718d7e5591e812313dd72677d9fad0.tar.xz |
wifi: nl80211: return error message for malformed chandef
Add an error message to the missing frequency case to have all
-EINVAL in nl80211_parse_chandef() return a better error.
Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230130074514.1560021-1-jaewan@google.com
[rewrite commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/wireless/nl80211.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 50515a5de64d..c82c66c32faa 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3181,8 +3181,11 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, struct nlattr **attrs = info->attrs; u32 control_freq; - if (!attrs[NL80211_ATTR_WIPHY_FREQ]) + if (!attrs[NL80211_ATTR_WIPHY_FREQ]) { + NL_SET_ERR_MSG_ATTR(extack, attrs[NL80211_ATTR_WIPHY_FREQ], + "Frequency is missing"); return -EINVAL; + } control_freq = MHZ_TO_KHZ( nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); |