All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Chenguang Zhao <chenguang.zhao@linux.dev>
Cc: jgg@ziepe.ca, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	tariqt@nvidia.com, mbloch@nvidia.com, dtatulea@nvidia.com,
	shayd@nvidia.com, moshe@nvidia.com,
	Chenguang Zhao <zhaochenguang@kylinos.cn>
Subject: Re: [PATCH rdma-next v3] RDMA/mlx5: quiesce CQ polling before device shutdown on reboot
Date: Thu, 16 Jul 2026 11:42:11 +0300	[thread overview]
Message-ID: <20260716084211.GC70906@unreal> (raw)
In-Reply-To: <20260715082307.1593915-1-chenguang.zhao@linux.dev>

On Wed, Jul 15, 2026 at 04:23:07PM +0800, Chenguang Zhao wrote:
> From: Chenguang Zhao <zhaochenguang@kylinos.cn>
> 
> On reboot -f with NFS over RDMA, mlx5 shutdown can tear the device
> down while ib-comp-wq still polls live CQs, leading to UAF in
> wr_cqe->done().
> 
> Mark the device shutting down before teardown, flush completion
> workqueues so in-flight pollers observe the flag, skip SYS_ERROR
> completion delivery, and make poll/arm CQ a no-op under the CQ lock
> while shutting down.
> 
> Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
> ---
> changelog:
>  - Fix the race on MLX5_INTERFACE_STATE_SHUTTING_DOWN: set the
>    flag, then flush ib-comp / mlx5_ib event workqueues via an
>    mlx5_ib quiesce hook before fast_unload/teardown.
>  - Check shutting-down under cq->lock in mlx5_ib_poll_cq/arm_cq.
>  - Export ib_comp_wq and ib_comp_unbound_wq so modular mlx5_ib
>    can flush them.
> 
> v2:
>  https://lore.kernel.org/all/20260714075558.1420384-1-chenguang.zhao@linux.dev/
> 
> v1:
>  https://lore.kernel.org/all/20260702073422.279820-1-chenguang.zhao@linux.dev/
> 
>  drivers/infiniband/core/device.c              |  2 ++
>  drivers/infiniband/hw/mlx5/cq.c               | 11 ++++++++++
>  drivers/infiniband/hw/mlx5/main.c             | 20 +++++++++++++++++++
>  .../net/ethernet/mellanox/mlx5/core/health.c  |  3 +++
>  .../net/ethernet/mellanox/mlx5/core/main.c    | 10 ++++++++++
>  .../mellanox/mlx5/core/sf/dev/driver.c        |  3 +++
>  include/linux/mlx5/driver.h                   | 11 ++++++++++
>  7 files changed, 60 insertions(+)

<...>

> +static void mlx5_ib_shutdown_quiesce(void)
> +{
> +	flush_workqueue(ib_comp_wq);
> +	flush_workqueue(ib_comp_unbound_wq);
> +	flush_workqueue(mlx5_ib_event_wq);
> +}

These workqueues are shared by all IB drivers and the core. Drivers
must not flush or destroy them.

Why this is not FW issue?

Thanks

  reply	other threads:[~2026-07-16  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  8:23 [PATCH rdma-next v3] RDMA/mlx5: quiesce CQ polling before device shutdown on reboot Chenguang Zhao
2026-07-16  8:42 ` Leon Romanovsky [this message]
2026-07-16  9:03   ` Chenguang Zhao
2026-07-16 10:50     ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260716084211.GC70906@unreal \
    --to=leon@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenguang.zhao@linux.dev \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@google.com \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shayd@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=zhaochenguang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.