qcacld-3.0: Fix cdp API null check in wma_is_pkt_drop_candidate()
Fix cdp API null check in wma_is_pkt_drop_candidate. Add check if _last_received is greater than 0 before checking for DOS attack. Change-Id: Ic817e9a3d59100be5cb97f833985b7633391e1ca CRs-Fixed: 1115648
This commit is contained in:

committed by
qcabuildsw

parent
69588ad3f1
commit
3ce25ed456
@@ -3114,9 +3114,8 @@ static bool wma_is_pkt_drop_candidate(tp_wma_handle wma_handle,
|
|||||||
WMA_LOGE(FL("cdp_peer_last_assoc_received Failed"));
|
WMA_LOGE(FL("cdp_peer_last_assoc_received Failed"));
|
||||||
should_drop = true;
|
should_drop = true;
|
||||||
goto end;
|
goto end;
|
||||||
} else {
|
} else if (*ptr > 0) {
|
||||||
if ((qdf_get_system_timestamp() -
|
if ((qdf_get_system_timestamp() - *ptr) <
|
||||||
*cdp_peer_last_assoc_received(soc, peer)) <
|
|
||||||
WMA_MGMT_FRAME_DETECT_DOS_TIMER) {
|
WMA_MGMT_FRAME_DETECT_DOS_TIMER) {
|
||||||
WMA_LOGI(FL("Dropping Assoc Req received"));
|
WMA_LOGI(FL("Dropping Assoc Req received"));
|
||||||
should_drop = true;
|
should_drop = true;
|
||||||
@@ -3126,9 +3125,13 @@ static bool wma_is_pkt_drop_candidate(tp_wma_handle wma_handle,
|
|||||||
qdf_get_system_timestamp();
|
qdf_get_system_timestamp();
|
||||||
break;
|
break;
|
||||||
case SIR_MAC_MGMT_DISASSOC:
|
case SIR_MAC_MGMT_DISASSOC:
|
||||||
if (*cdp_peer_last_disassoc_received(soc, peer)) {
|
ptr = cdp_peer_last_disassoc_received(soc, peer);
|
||||||
if ((qdf_get_system_timestamp() -
|
if (ptr == NULL) {
|
||||||
*cdp_peer_last_disassoc_received(soc, peer)) <
|
WMA_LOGE(FL("cdp_peer_last_disassoc_received Failed"));
|
||||||
|
should_drop = true;
|
||||||
|
goto end;
|
||||||
|
} else if (*ptr > 0) {
|
||||||
|
if ((qdf_get_system_timestamp() - *ptr) <
|
||||||
WMA_MGMT_FRAME_DETECT_DOS_TIMER) {
|
WMA_MGMT_FRAME_DETECT_DOS_TIMER) {
|
||||||
WMA_LOGI(FL("Dropping DisAssoc received"));
|
WMA_LOGI(FL("Dropping DisAssoc received"));
|
||||||
should_drop = true;
|
should_drop = true;
|
||||||
@@ -3138,9 +3141,13 @@ static bool wma_is_pkt_drop_candidate(tp_wma_handle wma_handle,
|
|||||||
qdf_get_system_timestamp();
|
qdf_get_system_timestamp();
|
||||||
break;
|
break;
|
||||||
case SIR_MAC_MGMT_DEAUTH:
|
case SIR_MAC_MGMT_DEAUTH:
|
||||||
if (*cdp_peer_last_deauth_received(soc, peer)) {
|
ptr = cdp_peer_last_deauth_received(soc, peer);
|
||||||
if ((qdf_get_system_timestamp() -
|
if (ptr == NULL) {
|
||||||
*cdp_peer_last_deauth_received(soc, peer)) <
|
WMA_LOGE(FL("cdp_peer_last_deauth_received Failed"));
|
||||||
|
should_drop = true;
|
||||||
|
goto end;
|
||||||
|
} else if (*ptr > 0) {
|
||||||
|
if ((qdf_get_system_timestamp() - *ptr) <
|
||||||
WMA_MGMT_FRAME_DETECT_DOS_TIMER) {
|
WMA_MGMT_FRAME_DETECT_DOS_TIMER) {
|
||||||
WMA_LOGI(FL("Dropping Deauth received"));
|
WMA_LOGI(FL("Dropping Deauth received"));
|
||||||
should_drop = true;
|
should_drop = true;
|
||||||
|
Reference in New Issue
Block a user