Explorar o código

qcacld-3.0: Check condition before loop in csr_get_active_scan_entry

In function csr_get_active_scan_entry change do while to while loop
so that localentry could be checked before entering loop and avoid
null pointer dereference.

Change-Id: I12cb84b38636ce0d97d7ddf01ad7ed7cd414e80c
CRs-Fixed: 1091486
Naveen Rawat %!s(int64=8) %!d(string=hai) anos
pai
achega
816c6d3b00
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      core/sme/src/csr/csr_api_scan.c

+ 2 - 2
core/sme/src/csr/csr_api_scan.c

@@ -4171,7 +4171,7 @@ QDF_STATUS csr_get_active_scan_entry(tpAniSirGlobal mac_ctx,
 	}
 	localentry = csr_ll_peek_head(&mac_ctx->sme.smeScanCmdActiveList,
 			LL_ACCESS_NOLOCK);
-	do {
+	 while (localentry) {
 		cmd = GET_BASE_ADDR(localentry, tSmeCmd, Link);
 		if (cmd->command == eSmeCommandScan)
 			cmd_scan_id = cmd->u.scanCmd.u.scanRequest.scan_id;
@@ -4186,7 +4186,7 @@ QDF_STATUS csr_get_active_scan_entry(tpAniSirGlobal mac_ctx,
 		}
 		localentry = csr_ll_next(&mac_ctx->sme.smeScanCmdActiveList,
 				localentry, LL_ACCESS_NOLOCK);
-	} while (localentry);
+	}
 	csr_ll_unlock(&mac_ctx->sme.smeScanCmdActiveList);
 	return status;
 }