wifi: ieee80211: check for NULL in ieee80211_mle_size_ok()
authorJohannes Berg <johannes.berg@intel.com>
Mon, 18 Mar 2024 16:53:17 +0000 (18:53 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 25 Mar 2024 14:38:12 +0000 (15:38 +0100)
For simplicity, we may want to pass a NULL element, and
while we should then pass also a zero length, just be a
bit more careful here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240318184907.4d983653cb8d.Ic3ea99b60c61ac2f7d38cb9fd202a03c97a05601@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/linux/ieee80211.h

index 3385a2cc5b0995dc695b64aae1224dbb7341a46f..a99f048404b8643ecf03dd531e77e9e4c25f2d4b 100644 (file)
@@ -5166,7 +5166,7 @@ static inline bool ieee80211_mle_size_ok(const u8 *data, size_t len)
        bool check_common_len = false;
        u16 control;
 
-       if (len < fixed)
+       if (!data || len < fixed)
                return false;
 
        control = le16_to_cpu(mle->control);