Skip to content

Commit

Permalink
net/mlx5e: Fix XDP error path of mlx5e_open_channel()
Browse files Browse the repository at this point in the history
In case of mlx5e_open_rq fails the error handling will jump to
label err_close_xdp_sq and will try to close the xdp_sq unconditionally.
xdp_sq is valid only in case of XDP use cases, i.e priv->xdp_prog is
not null.

To fix this in this patch we test xdp_sq validity prior to closing it.

In addition we now close the xdp_sq.cq as well.

Fixes: b5503b9 ("net/mlx5e: XDP TX forwarding support")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Saeed Mahameed authored and David S. Miller committed Nov 4, 2016
1 parent 243d521 commit 87dc025
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,10 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,

return 0;
err_close_xdp_sq:
mlx5e_close_sq(&c->xdp_sq);
if (priv->xdp_prog) {
mlx5e_close_sq(&c->xdp_sq);
mlx5e_close_cq(&c->xdp_sq.cq);
}

err_close_sqs:
mlx5e_close_sqs(c);
Expand Down

0 comments on commit 87dc025

Please sign in to comment.