Skip to content

Commit

Permalink
wifi: nl80211: Add checks for nla_nest_start() in nl80211_send_iface()
Browse files Browse the repository at this point in the history
[ Upstream commit 5cc58b3 ]

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

Fixes: ce08cd3 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yuan Can authored and gregkh committed Dec 31, 2022
1 parent 16984b6 commit 687b6b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -3868,6 +3868,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,
Expand Down

0 comments on commit 687b6b3

Please sign in to comment.