From: Yuan Can Date: Tue, 29 Nov 2022 01:42:11 +0000 (+0000) Subject: wifi: nl80211: Add checks for nla_nest_start() in nl80211_send_iface() X-Git-Tag: v6.1.8~1514 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=687b6b37c09481a39ec60cfa94e7049daeb1af2f;p=platform%2Fkernel%2Flinux-starfive.git wifi: nl80211: Add checks for nla_nest_start() in nl80211_send_iface() [ Upstream commit 5cc58b376675981386c6192405fe887cd29c527a ] As the nla_nest_start() may fail with NULL returned, the return value needs to be checked. Fixes: ce08cd344a00 ("wifi: nl80211: expose link information for interfaces") Signed-off-by: Yuan Can Link: https://lore.kernel.org/r/20221129014211.56558-1-yuancan@huawei.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 597c522..d2321c6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -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,