Browse Source

qcacld-3.0: Set tfm to NULL to avoid freeing in crypto_free_cipher

qcacld-2.0 to qcacld-3.0 propagation

tfm is invalid when alloc fails. Set tfm to NULL to avoid freeing
the crypto transform in crypto_free_cipher()->crypto_destroy_tfm.

Change-Id: I3261377f3a7b6ab5740d4144be9e84a1a3a07e42
CRs-Fixed: 809085
DARAM SUDHA 10 năm trước cách đây
mục cha
commit
88a8cf2817
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      core/cds/src/cds_utils.c

+ 2 - 0
core/cds/src/cds_utils.c

@@ -387,6 +387,7 @@ cds_attach_mmie(uint8_t *igtk, uint8_t *ipn, uint16_t key_id,
 	tfm = cds_crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm)) {
 		ret = PTR_ERR(tfm);
+		tfm = NULL;
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
 			  "%s: crypto_alloc_cipher failed (%d)", __func__, ret);
 		goto err_tfm;
@@ -497,6 +498,7 @@ cds_is_mmie_valid(uint8_t *igtk, uint8_t *ipn, uint8_t *frm, uint8_t *efrm)
 	tfm = cds_crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm)) {
 		ret = PTR_ERR(tfm);
+		tfm = NULL;
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
 			  "crypto_alloc_cipher failed (%d)", ret);
 		goto err_tfm;