From: Michal Krawczyk Date: Thu, 17 Sep 2020 05:30:20 +0000 (+0200) Subject: net/ena/base: fix release of wait event X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f034d4bb973a23e6dd2af8acdc3829b013962e47;p=dpdk.git net/ena/base: fix release of wait event The wait event is being accessed without making sure it the completion context exists. The check for that is just below, so it could be used for releasing wait even safely. Fixes: 3adcba9a8987 ("net/ena: update HAL to the newer version") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk Reviewed-by: Igor Chauskin Reviewed-by: Guy Tzalik Reviewed-by: Stephen Hemminger --- diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c index b4e54318c6..ce239ab164 100644 --- a/drivers/net/ena/base/ena_com.c +++ b/drivers/net/ena/base/ena_com.c @@ -1655,11 +1655,13 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev) struct ena_com_aenq *aenq = &ena_dev->aenq; u16 size; - ENA_WAIT_EVENT_DESTROY(admin_queue->comp_ctx->wait_event); - if (admin_queue->comp_ctx) + if (admin_queue->comp_ctx) { + ENA_WAIT_EVENT_DESTROY(admin_queue->comp_ctx->wait_event); ENA_MEM_FREE(ena_dev->dmadev, admin_queue->comp_ctx, (admin_queue->q_depth * sizeof(struct ena_comp_ctx))); + } + admin_queue->comp_ctx = NULL; size = ADMIN_SQ_SIZE(admin_queue->q_depth); if (sq->entries)