Skip to content

Commit

Permalink
security: fix crash at accessing non-implemented ops
Browse files Browse the repository at this point in the history
[ upstream commit 34dff8b ]

Valid checks for optional function pointers inside dev-ops
were disabled by undefined macro.

Fixes: b6ee985 ("security: fix verification of parameters")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
  • Loading branch information
kananyev authored and kevintraynor committed May 27, 2020
1 parent 56090ed commit ce2659e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/librte_security/rte_security.c
Expand Up @@ -108,10 +108,11 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
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);
RTE_PTR_OR_ERR_RET(instance, -EINVAL);
RTE_PTR_OR_ERR_RET(instance->ops, -EINVAL);
#endif
RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->set_pkt_metadata, -ENOTSUP);
return instance->ops->set_pkt_metadata(instance->device,
sess, m, params);
}
Expand All @@ -122,8 +123,10 @@ 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);
RTE_PTR_OR_ERR_RET(instance, NULL);
RTE_PTR_OR_ERR_RET(instance->ops, NULL);
#endif
RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_userdata, NULL);
if (instance->ops->get_userdata(instance->device, md, &userdata))
return NULL;

Expand Down

0 comments on commit ce2659e

Please sign in to comment.