efx_tc_ct_replace() publishes a new entry in ct_ht before parsing and programming it. If later setup fails, the release path removes the entry and immediately releases its counter and frees the object. efx_tc_ct_stats() may already have found the entry under RCU and still be using conn->cnt. Wait for an RCU grace period after removing a failed published entry before reclaiming its resources. Fixes: 1909387fcfcf ("sfc: offload conntrack flow entries (match only) from CT zones") Signed-off-by: Jaeyeong Lee --- drivers/net/ethernet/sfc/tc_conntrack.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/sfc/tc_conntrack.c b/drivers/net/ethernet/sfc/tc_conntrack.c index 77ce2eca4..38688ae4e 100644 --- a/drivers/net/ethernet/sfc/tc_conntrack.c +++ b/drivers/net/ethernet/sfc/tc_conntrack.c @@ -443,11 +443,13 @@ static int efx_tc_ct_replace(struct efx_tc_ct_zone *ct_zone, mutex_unlock(&ct_zone->mutex); return 0; release: - if (conn->cnt) - efx_tc_flower_release_counter(efx, conn->cnt); - if (!old) + if (!old) { rhashtable_remove_fast(&efx->tc->ct_ht, &conn->linkage, efx_tc_ct_ht_params); + synchronize_rcu(); + } + if (conn->cnt) + efx_tc_flower_release_counter(efx, conn->cnt); kfree(conn); return rc; } -- 2.43.0