mac80211: mlme: check for null after calling kmemdup
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Wed, 5 Jan 2022 08:15:59 +0000 (16:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Feb 2022 11:03:10 +0000 (12:03 +0100)
commit00fb850c8a1a9893351ca52e56dc0bfc6ce20597
treee0bac2a8d2d4fbcfbd343c749840fa828354e284
parent61e8fc49a9f8c9f26461222e9bb5fc6814eb27c9
mac80211: mlme: check for null after calling kmemdup

commit a72c01a94f1d285a274219d36e2a17b4846c0615 upstream.

As the possible failure of the alloc, the ifmgd->assoc_req_ies might be
NULL pointer returned from kmemdup().
Therefore it might be better to free the skb and return error in order
to fail the association, like ieee80211_assoc_success().
Also, the caller, ieee80211_do_assoc(), needs to deal with the return
value from ieee80211_send_assoc().

Fixes: 4d9ec73d2b78 ("cfg80211: Report Association Request frame IEs in association events")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220105081559.2387083-1-jiasheng@iscas.ac.cn
[fix some paths to be errors, not success]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mac80211/mlme.c