Netdev List
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net 1/6] net/mlx5e: Fix XDP error path of mlx5e_open_channel()
Date: Fri,  4 Nov 2016 01:48:42 +0200	[thread overview]
Message-ID: <1478216927-31328-2-git-send-email-saeedm@mellanox.com> (raw)
In-Reply-To: <1478216927-31328-1-git-send-email-saeedm@mellanox.com>

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: b5503b994ed5 ("net/mlx5e: XDP TX forwarding support")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index f4c687c..c83619d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -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);
-- 
2.7.4

  reply	other threads:[~2016-11-03 23:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 23:48 [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 Saeed Mahameed
2016-11-03 23:48 ` Saeed Mahameed [this message]
2016-11-03 23:48 ` [PATCH net 2/6] net/mlx5e: Re-arrange XDP SQ/CQ creation Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 3/6] net/mlx5e: Disallow changing name-space for VF representors Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 4/6] net/mlx5e: Handle matching on vlan priority for offloaded TC rules Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 5/6] net/mlx5: E-Switch, Set the actions for offloaded rules properly Saeed Mahameed
2016-11-03 23:48 ` [PATCH net 6/6] net/mlx5: Fix invalid pointer reference when prof_sel parameter is invalid Saeed Mahameed
2016-11-04 19:00 ` [PATCH net 0/6] Mellanox 100G mlx5 fixes 2016-11-04 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478216927-31328-2-git-send-email-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox