net/bnxt: fix handling interface change status
[dpdk.git] / drivers / crypto / mvsam / rte_mrvl_pmd_ops.c
index ef52035..56a5450 100644 (file)
@@ -727,7 +727,7 @@ mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
 /** Configure the session from a crypto xform chain (PMD ops callback).
  *
  * @param dev Pointer to the device structure.
- * @param xform Pointer to the crytpo configuration structure.
+ * @param xform Pointer to the crypto configuration structure.
  * @param sess Pointer to the empty session structure.
  * @returns 0 upon success, negative value otherwise.
  */
@@ -751,6 +751,8 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
                return -ENOMEM;
        }
 
+       memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
+
        ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
        if (ret != 0) {
                MRVL_LOG(ERR, "Failed to configure session parameters!");
@@ -769,6 +771,12 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
                return -EIO;
        }
 
+       /* free the keys memory allocated for session creation */
+       if (mrvl_sess->sam_sess_params.cipher_key != NULL)
+               free(mrvl_sess->sam_sess_params.cipher_key);
+       if (mrvl_sess->sam_sess_params.auth_key != NULL)
+               free(mrvl_sess->sam_sess_params.auth_key);
+
        return 0;
 }