Commit 581642f3 authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5e: kTLS, Fix leak on resync error flow

Resync progress params buffer and dma weren't released on error,
Add missing error unwinding for resync_post_get_progress_params().

Fixes: 0419d8c9 ("net/mlx5e: kTLS, Add kTLS RX resync support")
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
parent 66ce5fc0
...@@ -258,7 +258,7 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, ...@@ -258,7 +258,7 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE); PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) { if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) {
err = -ENOMEM; err = -ENOMEM;
goto err_out; goto err_free;
} }
buf->priv_rx = priv_rx; buf->priv_rx = priv_rx;
...@@ -266,7 +266,7 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, ...@@ -266,7 +266,7 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1); BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1);
if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) { if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) {
err = -ENOSPC; err = -ENOSPC;
goto err_out; goto err_dma_unmap;
} }
pi = mlx5e_icosq_get_next_pi(sq, 1); pi = mlx5e_icosq_get_next_pi(sq, 1);
...@@ -297,6 +297,10 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, ...@@ -297,6 +297,10 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
return cseg; return cseg;
err_dma_unmap:
dma_unmap_single(pdev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
err_free:
kfree(buf);
err_out: err_out:
priv_rx->stats->tls_resync_req_skip++; priv_rx->stats->tls_resync_req_skip++;
return ERR_PTR(err); return ERR_PTR(err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment