[dpdk-dev] [PATCH 03/13] librte_security: fix session counter

Anoob Joseph anoobj at marvell.com
Tue Mar 17 18:08:31 CET 2020


Hi Lukasz,

The title need to be changed (librte_security -> security). With that change,

Acked-by: Anoob Joseph <anoobj at marvell.com>

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Lukasz Wojciechowski
> Sent: Thursday, March 12, 2020 8:47 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 03/13] librte_security: fix session counter
> 
> Fix session counter to be decreased in rte_security_session_destroy only when
> session was successfully destoyed.
> 
> Formerly session counter was decreased prior session destroying and returning
> session object to mempool. It remained decreased even if session was not
> destroyed and mempool object released making counter invalid.
> 
> Signed-off-by: Lukasz Wojciechowski <l.wojciechow at partner.samsung.com>
> Change-Id: I75ebfc26811ec2159b973fae36b2c9fb08868f11
> ---
>  lib/librte_security/rte_security.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c
> index 40a0e9ce5..74a314903 100644
> --- a/lib/librte_security/rte_security.c
> +++ b/lib/librte_security/rte_security.c
> @@ -87,14 +87,16 @@ rte_security_session_destroy(struct rte_security_ctx
> *instance,
>  	RTE_PTR_OR_ERR_RET(instance->ops->session_destroy, -ENOTSUP);
>  	RTE_PTR_OR_ERR_RET(sess, -EINVAL);
> 
> +	ret = instance->ops->session_destroy(instance->device, sess);
> +	if (ret != 0)
> +		return ret;
> +
> +	rte_mempool_put(rte_mempool_from_obj(sess), (void *)sess);
> +
>  	if (instance->sess_cnt)
>  		instance->sess_cnt--;
> 
> -	ret = instance->ops->session_destroy(instance->device, sess);
> -	if (!ret)
> -		rte_mempool_put(rte_mempool_from_obj(sess), (void *)sess);
> -
> -	return ret;
> +	return 0;
>  }
> 
>  int
> --
> 2.17.1



More information about the dev mailing list