The interrupt handle in the DPIO device is separate from the bus device
object handle. The cleanup code was leaking this handle and the FD it
carries.

Fixes: 274fd921ff7f ("bus/fslmc: support close operation")

Signed-off-by: David Marchand <[email protected]>
---
Changes since v1:
- fixed FD leaks,

---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 9fe449ed38..2e8c660acf 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -476,6 +476,10 @@ dpaa2_close_dpio_device(int object_id)
                        rte_free(dpio_dev->dpio);
                }
                TAILQ_REMOVE(&dpio_dev_list, dpio_dev, next);
+               rte_intr_fd_close(dpio_dev->intr_handle);
+               /* dev_fd is closed by caller, clear reference here. */
+               rte_intr_dev_fd_set(dpio_dev->intr_handle, -1);
+               rte_intr_instance_free(dpio_dev->intr_handle);
                rte_free(dpio_dev);
        }
 }
@@ -668,6 +672,9 @@ dpaa2_create_dpio_device(int vdev_fd,
                rte_free(dpio_dev->dpio);
        }
 
+       rte_intr_fd_close(dpio_dev->intr_handle);
+       /* dev_fd is closed by caller, clear reference here. */
+       rte_intr_dev_fd_set(dpio_dev->intr_handle, -1);
        rte_intr_instance_free(dpio_dev->intr_handle);
        rte_free(dpio_dev);
 
@@ -680,6 +687,9 @@ dpaa2_create_dpio_device(int vdev_fd,
                                dpio_dev->token);
                        rte_free(dpio_dev->dpio);
                }
+               rte_intr_fd_close(dpio_dev->intr_handle);
+               /* dev_fd is closed by caller, clear reference here. */
+               rte_intr_dev_fd_set(dpio_dev->intr_handle, -1);
                rte_intr_instance_free(dpio_dev->intr_handle);
                rte_free(dpio_dev);
        }
-- 
2.54.0

Reply via email to