UPSTREAM: wifi: nl80211: Add checks for nla_nest_start() in nl80211_send_iface()

As the nla_nest_start() may fail with NULL returned, the return value needs
to be checked.

Bug: 254441685
Fixes: ce08cd344a00 ("wifi: nl80211: expose link information for interfaces")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Link: https://lore.kernel.org/r/20221129014211.56558-1-yuancan@huawei.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit 5cc58b376675981386c6192405fe887cd29c527a)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I768efc70d510ceca499ebb96810de1a9949ffa25
This commit is contained in:
Yuan Can
2022-11-29 01:42:11 +00:00
committed by Lee Jones
parent 8b1316dd5b
commit 7dc85abaac

View File

@@ -3875,6 +3875,9 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
struct cfg80211_chan_def chandef = {};
int ret;
if (!link)
goto nla_put_failure;
if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id))
goto nla_put_failure;
if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,