mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
wifi: cfg80211: fix off-by-one in element defrag
[ Upstream commit43125539fc
] If a fragment is the last element, it's erroneously not accepted. Fix that. Fixes:f837a653a0
("wifi: cfg80211: add element defragmentation helper") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230827135854.adca9fbd3317.I6b2df45eb71513f3e48efd196ae3cddec362dc1c@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2c1d8b0468
commit
5b386ed2d4
1 changed files with 2 additions and 2 deletions
|
@ -2358,8 +2358,8 @@ ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,
|
|||
|
||||
/* elem might be invalid after the memmove */
|
||||
next = (void *)(elem->data + elem->datalen);
|
||||
|
||||
elem_datalen = elem->datalen;
|
||||
|
||||
if (elem->id == WLAN_EID_EXTENSION) {
|
||||
copied = elem->datalen - 1;
|
||||
if (copied > data_len)
|
||||
|
@ -2380,7 +2380,7 @@ ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,
|
|||
|
||||
for (elem = next;
|
||||
elem->data < ies + ieslen &&
|
||||
elem->data + elem->datalen < ies + ieslen;
|
||||
elem->data + elem->datalen <= ies + ieslen;
|
||||
elem = next) {
|
||||
/* elem might be invalid after the memmove */
|
||||
next = (void *)(elem->data + elem->datalen);
|
||||
|
|
Loading…
Reference in a new issue