git: bafce48d55d8 - stable/13 - mlx5en: Add missing refcount decrement on link-down.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Thu, 24 Feb 2022 10:04:23 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=bafce48d55d8d62160bc810fe34b08b94b6ba3c6

commit bafce48d55d8d62160bc810fe34b08b94b6ba3c6
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-24 09:59:01 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-24 09:59:01 +0000

    mlx5en: Add missing refcount decrement on link-down.
    
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit d2a788a522f78f7c4b014df9097348419d90fae4)
---
 sys/dev/mlx5/mlx5_en/mlx5_en_iq.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_iq.c b/sys/dev/mlx5/mlx5_en/mlx5_en_iq.c
index e375864dc85f..6553b002aa1b 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_iq.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_iq.c
@@ -141,6 +141,10 @@ mlx5e_iq_free_db(struct mlx5e_iq *iq)
 			iq->data[x].callback(iq->data[x].arg);
 			iq->data[x].callback = NULL;
 		}
+		if (unlikely(iq->data[x].p_refcount != NULL)) {
+			atomic_add_int(iq->data[x].p_refcount, -1);
+			iq->data[x].p_refcount = NULL;
+		}
 		bus_dmamap_destroy(iq->dma_tag, iq->data[x].dma_map);
 	}
 	free(iq->data, M_MLX5EN);