[lvc-project] [PATCH] cryptodev: reset resource pointers in init error path

Fedor Pchelkin pchelkin at ispras.ru
Wed Apr 15 11:21:23 MSK 2026


On Tue, 14. Apr 21:30, Daniil Iskhakov wrote:
> cryptodev_cb_init() may free partially allocated resources on failure,
> but does not reset their pointers afterwards.
> 
> A later call to cryptodev_cb_cleanup() may then attempt to release both
> resources even when one of them has already been freed, because the
> cleanup logic does not rely on both pointers being valid independently.
> 
> Set freed pointers to NULL in the cryptodev_cb_init() error path to
> make subsequent cleanup safe.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 1c3ffb95595e ("cryptodev: add enqueue and dequeue callbacks")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Daniil Iskhakov <dish at amicon.ru>
> Signed-off-by: Daniil Agalakov <ade at amicon.ru>
> ---

Патчи в DPDK отправляются в другой список рассылки sdl.dpdk at linuxtesting.org
согласно
https://gitlab.community.ispras.ru/cc-portal/intro#набор-компонентов-для-которых-исследования-стартовали

lvc-project только для ядра.

Насчёт порядка подписей: обычно последней идёт подпись того, кто и
отправляет патч.  Про Co-developed-by в dpdk не знаю, возможно это
только прихоть оформления патчей для ядра.  Пустая строка между
Fixes/Cc-stable и Signed-off-by в ядре не нужна, а для dpdk похоже
наоборот нужна, да.


Сами правки выглядят ОК.

> Cc: abhinandan.gujjar at intel.com
> Cc: lvc-project at linuxtesting.org
> ---
>  lib/cryptodev/rte_cryptodev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
> index 50071935c2..5cb9c93c77 100644
> --- a/lib/cryptodev/rte_cryptodev.c
> +++ b/lib/cryptodev/rte_cryptodev.c
> @@ -811,6 +811,7 @@ cryptodev_cb_init(struct rte_cryptodev *dev)
>  	if (dev->deq_cbs == NULL) {
>  		CDEV_LOG_ERR("Failed to allocate memory for deq callbacks");
>  		rte_free(dev->enq_cbs);
> +		dev->enq_cbs = NULL;
>  		return -ENOMEM;
>  	}
>  
> -- 
> 2.43.0



More information about the lvc-project mailing list