patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 19.11] net/mlx5: cleanup Netlink interrupt handler
@ 2022-09-08  9:34 Dmitry Kozlyuk
  2022-12-07 12:46 ` Ali Alnubani
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Kozlyuk @ 2022-09-08  9:34 UTC (permalink / raw)
  To: stable; +Cc: Suanming Mou, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

[ upstream commit 17f95513adca1f4ee5bba305b154ac984ee50cee ]

When the upstream commit was backported by the offending commit,
the cleanup part of the fix was missed. The interrupt handler
was not unregistered and the Netlink socket was not closed
with the device closing. The socket was leaking and the handler
could continue working with random content in the freed memory:

    net_mlx5: Failed to process Netlink events: \
        Socket operation on non-socket

Fixes: edea6144b47f ("net/mlx5: fix link status change detection")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
 drivers/net/mlx5/mlx5.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index dee018bbba..f3b440635e 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -579,6 +579,11 @@ mlx5_dev_shared_handler_uninstall(struct mlx5_ibv_shared *sh)
 	if (sh->intr_handle.fd >= 0)
 		mlx5_intr_callback_unregister(&sh->intr_handle,
 					      mlx5_dev_interrupt_handler, sh);
+	if (sh->intr_handle_nl.fd >= 0) {
+		mlx5_intr_callback_unregister(&sh->intr_handle_nl,
+					      mlx5_dev_interrupt_handler_nl, sh);
+		close(sh->intr_handle_nl.fd);
+	}
 #ifdef HAVE_IBV_DEVX_ASYNC
 	if (sh->intr_handle_devx.fd >= 0)
 		rte_intr_callback_unregister(&sh->intr_handle_devx,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH 19.11] net/mlx5: cleanup Netlink interrupt handler
  2022-09-08  9:34 [PATCH 19.11] net/mlx5: cleanup Netlink interrupt handler Dmitry Kozlyuk
@ 2022-12-07 12:46 ` Ali Alnubani
  0 siblings, 0 replies; 2+ messages in thread
From: Ali Alnubani @ 2022-12-07 12:46 UTC (permalink / raw)
  To: Christian Ehrhardt, stable
  Cc: Suanming Mou, Matan Azrad, Shahaf Shuler, Slava Ovsiienko,
	Eman Hamayel, Bassam Zaid AlKilani, Raslan Darawsheh,
	Dmitry Kozlyuk

> -----Original Message-----
> From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> Sent: Thursday, September 8, 2022 12:34 PM
> To: stable@dpdk.org
> Cc: Suanming Mou <suanmingm@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>
> Subject: [PATCH 19.11] net/mlx5: cleanup Netlink interrupt handler
> 
> [ upstream commit 17f95513adca1f4ee5bba305b154ac984ee50cee ]
> 
> When the upstream commit was backported by the offending commit,
> the cleanup part of the fix was missed. The interrupt handler
> was not unregistered and the Netlink socket was not closed
> with the device closing. The socket was leaking and the handler
> could continue working with random content in the freed memory:
> 
>     net_mlx5: Failed to process Netlink events: \
>         Socket operation on non-socket
> 
> Fixes: edea6144b47f ("net/mlx5: fix link status change detection")
> 
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> Acked-by: Suanming Mou <suanmingm@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index dee018bbba..f3b440635e 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -579,6 +579,11 @@ mlx5_dev_shared_handler_uninstall(struct
> mlx5_ibv_shared *sh)
>  	if (sh->intr_handle.fd >= 0)
>  		mlx5_intr_callback_unregister(&sh->intr_handle,
>  					      mlx5_dev_interrupt_handler, sh);
> +	if (sh->intr_handle_nl.fd >= 0) {
> +		mlx5_intr_callback_unregister(&sh->intr_handle_nl,
> +					      mlx5_dev_interrupt_handler_nl,
> sh);
> +		close(sh->intr_handle_nl.fd);
> +	}
>  #ifdef HAVE_IBV_DEVX_ASYNC
>  	if (sh->intr_handle_devx.fd >= 0)
>  		rte_intr_callback_unregister(&sh->intr_handle_devx,
> --
> 2.25.1

Hi Christian,

Can you please help apply this patch to 19.11?

Thanks,
Ali

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-07 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08  9:34 [PATCH 19.11] net/mlx5: cleanup Netlink interrupt handler Dmitry Kozlyuk
2022-12-07 12:46 ` Ali Alnubani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).