Skip to content

Commit e692139

Browse files
Conchy-ConchySaeed Mahameed
authored andcommitted
net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq
The function invokes bpf_prog_inc(), which increases the reference count of a bpf_prog object "rq->xdp_prog" if the object isn't NULL. The refcount leak issues take place in two error handling paths. When either mlx5_wq_ll_create() or mlx5_wq_cyc_create() fails, the function simply returns the error code and forgets to drop the reference count increased earlier, causing a reference count leak of "rq->xdp_prog". Fix this issue by jumping to the error handling path err_rq_wq_destroy while either function fails. Fixes: 422d4c4 ("net/mlx5e: RX, Split WQ objects for different RQ types") Signed-off-by: Xin Xiong <[email protected]> Signed-off-by: Xiyu Yang <[email protected]> Signed-off-by: Xin Tan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 6f7bbad commit e692139

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+2
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
419419
err = mlx5_wq_ll_create(mdev, &rqp->wq, rqc_wq, &rq->mpwqe.wq,
420420
&rq->wq_ctrl);
421421
if (err)
422-
return err;
422+
goto err_rq_wq_destroy;
423423

424424
rq->mpwqe.wq.db = &rq->mpwqe.wq.db[MLX5_RCV_DBR];
425425

@@ -470,7 +470,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
470470
err = mlx5_wq_cyc_create(mdev, &rqp->wq, rqc_wq, &rq->wqe.wq,
471471
&rq->wq_ctrl);
472472
if (err)
473-
return err;
473+
goto err_rq_wq_destroy;
474474

475475
rq->wqe.wq.db = &rq->wqe.wq.db[MLX5_RCV_DBR];
476476

0 commit comments

Comments
 (0)