From a7315f2414da625d2bd9e58558eaa9e483f2ef92 Mon Sep 17 00:00:00 2001 From: Krishna Kumaar Natarajan Date: Sat, 20 Aug 2016 17:54:20 -0700 Subject: [PATCH] qcacld-3.0: Fix incorrect memory comparison in cds_is_mmie_valid Fix incorrect memory comparison cds_is_mmie_valid. In cds_is_mmie_valid(), while processing Rx Robust Management Frame invalid condition usage results in incorrectly tagging the Rx packet for replay attack. Similar invalid condition results in incorrectly tagging the packets for MIC mismatch. This change will update the checks so that Rx packets will not be dropped incorrectly. Change-Id: I50974232db034029747e0af8c8b5b70959c4dcb7 CRs-Fixed: 1057261 --- core/cds/src/cds_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/cds/src/cds_utils.c b/core/cds/src/cds_utils.c index 68726fdee775..67d6d3f2494f 100644 --- a/core/cds/src/cds_utils.c +++ b/core/cds/src/cds_utils.c @@ -483,7 +483,7 @@ cds_is_mmie_valid(uint8_t *igtk, uint8_t *ipn, uint8_t *frm, uint8_t *efrm) /* Validate IPN */ rx_ipn = mmie->sequence_number; - if (OS_MEMCMP(rx_ipn, ipn, CMAC_IPN_LEN) > 0) { + if (OS_MEMCMP(rx_ipn, ipn, CMAC_IPN_LEN) <= 0) { /* Replay error */ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, "Replay error mmie ipn %02X %02X %02X %02X %02X %02X" @@ -546,7 +546,7 @@ cds_is_mmie_valid(uint8_t *igtk, uint8_t *ipn, uint8_t *frm, uint8_t *efrm) mic[0], mic[1], mic[2], mic[3], mic[4], mic[5], mic[6], mic[7]); - if (OS_MEMCMP(mic, mmie->mic, CMAC_TLEN) == 0) { + if (OS_MEMCMP(mic, mmie->mic, CMAC_TLEN) != 0) { /* MMIE MIC mismatch */ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, "BC/MC MGMT frame MMIE MIC check Failed"