Hi Konstantin,

These are data path ops and so it will be better if we can avoid such checks in 
the datapath. The same is done in ethdev also.

http://code.dpdk.org/dpdk/v20.02/source/lib/librte_ethdev/rte_ethdev.h#L4372

Datapath functions in cryptodev (enqueue/dequeue) doesn't even have such checks.
http://code.dpdk.org/dpdk/v20.02/source/lib/librte_cryptodev/rte_cryptodev.h#L962


Thanks,
Anoob

> -----Original Message-----
> From: dev <dev-boun...@dpdk.org> On Behalf Of Konstantin Ananyev
> Sent: Thursday, April 23, 2020 5:22 AM
> To: dev@dpdk.org
> Cc: akhil.go...@nxp.com; declan.dohe...@intel.com; Konstantin Ananyev
> <konstantin.anan...@intel.com>
> Subject: [dpdk-dev] [PATCH] security: fix crash at accessing non-implemented
> ops
> 
> Valid checks for optional function pointers inside dev-ops were disabled by
> undefined macro.
> 
> Fixes: b6ee98547847 ("security: fix verification of parameters")
> 
> Signed-off-by: Konstantin Ananyev <konstantin.anan...@intel.com>
> ---
>  lib/librte_security/rte_security.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/lib/librte_security/rte_security.c 
> b/lib/librte_security/rte_security.c
> index d475b0977..b65430ce2 100644
> --- a/lib/librte_security/rte_security.c
> +++ b/lib/librte_security/rte_security.c
> @@ -107,11 +107,9 @@ rte_security_set_pkt_metadata(struct rte_security_ctx
> *instance,
>                             struct rte_security_session *sess,
>                             struct rte_mbuf *m, void *params)  { -#ifdef
> RTE_DEBUG
>       RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, set_pkt_metadata, -
> EINVAL,
>                       -ENOTSUP);
>       RTE_PTR_OR_ERR_RET(sess, -EINVAL);
> -#endif
>       return instance->ops->set_pkt_metadata(instance->device,
>                                              sess, m, params);
>  }
> @@ -121,9 +119,7 @@ rte_security_get_userdata(struct rte_security_ctx
> *instance, uint64_t md)  {
>       void *userdata = NULL;
> 
> -#ifdef RTE_DEBUG
>       RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, get_userdata, NULL,
> NULL); -#endif
>       if (instance->ops->get_userdata(instance->device, md, &userdata))
>               return NULL;
> 
> --
> 2.17.1

Reply via email to