Skip to content

Commit

Permalink
net/ena/base: restructure interrupt handling
Browse files Browse the repository at this point in the history
[ upstream commit 553653ccc18c1ed9fb0406e1b0130e945d5ab30f ]

When invoking an admin command, in interrupt mode, if the interrupt
is received after timeout and also after the calling function finished
running, the response will be written into a memory that is no longer
valid.

Fixes: 99ecfbf ("ena: import communication layer")

Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
  • Loading branch information
shaibran authored and bluca committed Mar 18, 2024
1 parent ad75918 commit c5251ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ena/base/ena_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ static int ena_com_admin_init_aenq(struct ena_com_dev *ena_dev,
static void comp_ctxt_release(struct ena_com_admin_queue *queue,
struct ena_comp_ctx *comp_ctx)
{
comp_ctx->user_cqe = NULL;
comp_ctx->occupied = false;
ATOMIC32_DEC(&queue->outstanding_cmds);
}
Expand Down Expand Up @@ -466,6 +467,9 @@ static void ena_com_handle_single_admin_completion(struct ena_com_admin_queue *a
return;
}

if (!comp_ctx->occupied)
return;

comp_ctx->status = ENA_CMD_COMPLETED;
comp_ctx->comp_status = cqe->acq_common_descriptor.status;

Expand Down

0 comments on commit c5251ed

Please sign in to comment.