Skip to content

Commit

Permalink
wifi: nl80211: return error message for malformed chandef
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jaewan Kim authored and Johannes Berg committed Feb 14, 2023
1 parent 08b7477 commit 90b2c3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down

0 comments on commit 90b2c3c

Please sign in to comment.