From: Radu Nicolau Date: Thu, 5 Jul 2018 10:04:42 +0000 (+0100) Subject: security: fix crash on destroy null session X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8a29f519ef1b2fdddb0324e867006c76c70173cb;p=dpdk.git security: fix crash on destroy null session rte_security_session_destroy should return -EINVAL if session is NULL, but segfaults because of rte_mempool_from_obj(NULL) call. Fixes: c261d1431bd8 ("security: introduce security API and framework") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau Acked-by: Akhil Goyal --- diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c index f36a8a0e72..1954960a50 100644 --- a/lib/librte_security/rte_security.c +++ b/lib/librte_security/rte_security.c @@ -63,7 +63,6 @@ rte_security_session_destroy(struct rte_security_ctx *instance, struct rte_security_session *sess) { int ret; - struct rte_mempool *mp = rte_mempool_from_obj(sess); RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->session_destroy, -ENOTSUP); @@ -72,7 +71,7 @@ rte_security_session_destroy(struct rte_security_ctx *instance, ret = instance->ops->session_destroy(instance->device, sess); if (!ret) - rte_mempool_put(mp, (void *)sess); + rte_mempool_put(rte_mempool_from_obj(sess), (void *)sess); return ret; }