Merge "qcacld-3.0: Fix underflow issue of beacon length"

This commit is contained in:
QCTECMDR Service 2025-09-06 01:02:37 -07:00 • committed by Gerrit - the friendly Code Review server
commit 43bab0792b

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -1171,20 +1171,28 @@ static void wma_update_beacon_noa_ie(struct beacon_info *bcn,
/* TODO: Assuming p2p noa ie is last ie in the beacon */
qdf_mem_zero(bcn->noa_ie, (bcn->noa_sub_ie_len +
sizeof(struct p2p_ie)));
bcn->len -= (bcn->noa_sub_ie_len +
sizeof(struct p2p_ie));
if (bcn->len < (bcn->noa_sub_ie_len +
sizeof(struct p2p_ie)))
bcn->len = 0;
else
bcn->len -= (bcn->noa_sub_ie_len +
sizeof(struct p2p_ie));
bcn->noa_ie = NULL;
bcn->noa_sub_ie_len = 0;
}
wma_debug("No need to update NoA");
return;
}
if (bcn->noa_sub_ie_len && bcn->noa_ie) {
if (bcn->len < (bcn->noa_sub_ie_len + sizeof(struct p2p_ie)))
bcn->len = 0;
else
bcn->len -= (bcn->noa_sub_ie_len +
sizeof(struct p2p_ie));
/* NoA present in previous beacon, update it */
wma_debug("NoA present in previous beacon, update the NoA IE, bcn->len %u bcn->noa_sub_ie_len %u",
bcn->len, bcn->noa_sub_ie_len);
bcn->len -= (bcn->noa_sub_ie_len + sizeof(struct p2p_ie));
bcn->len, bcn->noa_sub_ie_len);
qdf_mem_zero(bcn->noa_ie,
(bcn->noa_sub_ie_len + sizeof(struct p2p_ie)));
} else { /* NoA is not present in previous beacon */