net/sfc: fix adapter lock usage on rule creation

Message ID 20191103103309.10813-1-ivan.malov@oktetlabs.ru (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc: fix adapter lock usage on rule creation |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Ivan Malov Nov. 3, 2019, 10:33 a.m. UTC
  The point is that adapter lock has to be held on
list accesses, as well as when talking to the HW.

Fixes: a9825ccf5bb8 ("net/sfc: support flow API filters")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Nov. 7, 2019, 8:56 p.m. UTC | #1
On 11/3/2019 10:33 AM, Ivan Malov wrote:
> The point is that adapter lock has to be held on
> list accesses, as well as when talking to the HW.
> 
> Fixes: a9825ccf5bb8 ("net/sfc: support flow API filters")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index e4a9ba0ff..8d636f692 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -2315,10 +2315,10 @@  sfc_flow_create(struct rte_eth_dev *dev,
 	if (rc != 0)
 		goto fail_bad_value;
 
-	TAILQ_INSERT_TAIL(&sa->filter.flow_list, flow, entries);
-
 	sfc_adapter_lock(sa);
 
+	TAILQ_INSERT_TAIL(&sa->filter.flow_list, flow, entries);
+
 	if (sa->state == SFC_ADAPTER_STARTED) {
 		rc = sfc_flow_filter_insert(sa, flow);
 		if (rc != 0) {