All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@netronome.com>
To: David Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Louis Peens <louis.peens@netronome.com>,
	netdev@vger.kernel.org, oss-drivers@netronome.com,
	Simon Horman <simon.horman@netronome.com>,
	wenxu <wenxu@ucloud.cn>
Subject: [PATCH net] nfp: do not send control messages during cleanup
Date: Fri, 11 Dec 2020 10:27:38 +0100	[thread overview]
Message-ID: <20201211092738.3358-1-simon.horman@netronome.com> (raw)

On cleanup the txbufs are freed before app cleanup. But app clean-up may
result in control messages due to use of common control paths. There is no
need to clean-up the NIC in such cases so simply discard requests. Without
such a check a NULL pointer dereference occurs.

Fixes: a1db217861f3 ("net: flow_offload: fix flow_indr_dev_unregister path")
Cc: wenxu <wenxu@ucloud.cn>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Louis Peens <louis.peens@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index b4acf2f41e84..d86f68aa89bf 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -2084,6 +2084,15 @@ nfp_ctrl_tx_one(struct nfp_net *nn, struct nfp_net_r_vector *r_vec,
 	dp = &r_vec->nfp_net->dp;
 	tx_ring = r_vec->tx_ring;
 
+	if (!tx_ring->txbufs)
+		/* On cleanup the txbufs are freed before app cleanup.
+		 * But app clean-up may result in control messages due to
+		 * use of common control paths. There is no need to
+		 * clean-up the NIC in such cases so simply discard
+		 * requests.
+		 */
+		goto err_free;
+
 	if (WARN_ON_ONCE(skb_shinfo(skb)->nr_frags)) {
 		nn_dp_warn(dp, "Driver's CTRL TX does not implement gather\n");
 		goto err_free;
-- 
2.20.1


             reply	other threads:[~2020-12-11  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11  9:27 Simon Horman [this message]
2020-12-15  2:26 ` [PATCH net] nfp: do not send control messages during cleanup Jakub Kicinski
2020-12-15 10:22   ` Simon Horman

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=20201211092738.3358-1-simon.horman@netronome.com \
    --to=simon.horman@netronome.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=louis.peens@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=wenxu@ucloud.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.