qcacmn: Access wlan_crypto_cipher structure if key->valid flag is set

Access wlan_crypto_cipher structure if the key and cipher_table's
are valid. Also, added changes to avoid dangling pointer accessing
after deleting key.

Change-Id: Ia9a5942c9597f03eb1707d149797f33760eeac21
This commit is contained in:
Shiva Sankar Gajula
2021-04-14 23:39:22 +05:30
committed by Madan Koyyalamudi
부모 7aa318326f
커밋 4bdf46d8ed

파일 보기

@@ -1427,6 +1427,7 @@ QDF_STATUS wlan_crypto_delkey(struct wlan_objmgr_vdev *vdev,
/* Zero-out local key variables */
qdf_mem_zero(key, sizeof(struct wlan_crypto_key));
qdf_mem_free(key);
key = NULL;
ret_rel_ref:
if (peer)
@@ -1765,6 +1766,12 @@ QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev,
goto err;
}
}
if (!key->valid || !key->cipher_table) {
status = QDF_STATUS_E_INVAL;
goto err;
}
/* if tkip, is counter measures enabled, then drop the frame */
cipher_table = (struct wlan_crypto_cipher *)key->cipher_table;
status = cipher_table->decap(key, wbuf, tid, hdrlen);