summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2023-12-11 09:05:32 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-01 12:42:27 +0000
commit1c8d80125142294052e808df6aedce53fb2d0ed8 (patch)
treedf7321481952067770db68698ff3c3254afc44f6 /net
parent1ac3318338c446597675bc22912b83d068b44bf3 (diff)
downloadlinux-stable-1c8d80125142294052e808df6aedce53fb2d0ed8.tar.gz
linux-stable-1c8d80125142294052e808df6aedce53fb2d0ed8.tar.bz2
linux-stable-1c8d80125142294052e808df6aedce53fb2d0ed8.zip
wifi: mac80211: mesh: check element parsing succeeded
[ Upstream commit 1fc4a3eec50d726f4663ad3c0bb0158354d6647a ] ieee802_11_parse_elems() can return NULL, so we must check for the return value. Fixes: 5d24828d05f3 ("mac80211: always allocate struct ieee802_11_elems") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20231211085121.93dea364f3d3.Ie87781c6c48979fb25a744b90af4a33dc2d83a28@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/mesh_plink.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index a1e526419e9d..5c8a3ff0ae0c 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -1243,6 +1243,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
return;
}
elems = ieee802_11_parse_elems(baseaddr, len - baselen, true, NULL);
- mesh_process_plink_frame(sdata, mgmt, elems, rx_status);
- kfree(elems);
+ if (elems) {
+ mesh_process_plink_frame(sdata, mgmt, elems, rx_status);
+ kfree(elems);
+ }
}