From: Chaitanya Tata validate_uhr_capa() and validate_uhr_operation() return -EINVAL without setting an extack message, so userspace only learns that some attribute was invalid. While the 802.11bn draft is still changing this is easy to hit: hostapd built for P802.11bn/D1.5 fails to start an AP on a kernel that still expects the D1.4 UHR Operation element layout, and all it can log is nl80211: Beacon set failed: -22 (Invalid argument) Set an error message pointing at the attribute, as the other element validators in nl80211 already do. Signed-off-by: Chaitanya Tata --- net/wireless/nl80211.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8a5c9dd9d0db..af14bdcf7c50 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -548,8 +548,10 @@ static int validate_uhr_capa(const struct nlattr *attr, const u8 *data = nla_data(attr); unsigned int len = nla_len(attr); - if (!ieee80211_uhr_capa_size_ok(data, len, false)) + if (!ieee80211_uhr_capa_size_ok(data, len, false)) { + NL_SET_ERR_MSG_ATTR(extack, attr, "malformed UHR capabilities"); return -EINVAL; + } return 0; } @@ -559,8 +561,10 @@ static int validate_uhr_operation(const struct nlattr *attr, const u8 *data = nla_data(attr); unsigned int len = nla_len(attr); - if (!ieee80211_uhr_oper_size_ok(data, len)) + if (!ieee80211_uhr_oper_size_ok(data, len)) { + NL_SET_ERR_MSG_ATTR(extack, attr, "malformed UHR operation"); return -EINVAL; + } return 0; } -- 2.43.0