Netdev List
 help / color / mirror / Atom feed
From: Wei Hu <weh@linux.microsoft.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-hyperv@vger.kernel.org, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, weh@microsoft.com,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next v6 1/4] net: mana: prepare HWC ownership for safe reinitialization
Date: Fri,  9 Oct 2026 11:20:06 +0000	[thread overview]
Message-ID: <20261009112006.591265-1-weh@linux.microsoft.com> (raw)
In-Reply-To: <sashiko-outbox-164177@kernel.org>

On Thu, Oct 08, 2026 at 12:54:01PM +0000, sashiko-bot@kernel.org wrote:
> Can this dereference of cq race with mana_gd_destroy_queue() and cause a
> use-after-free?

Thanks for the review. I agree that the Ethernet CQ lifetime gap described
here needs to be fixed. However, it is already present on the base of this
series, c66d93e68728, rather than introduced by this patch.

On that base, mana_gd_destroy_cq() clears the CQ table entry without waiting
for existing readers, and mana_gd_destroy_queue() subsequently frees the
queue. Both functions and the Ethernet CQ-before-EQ teardown order are
unchanged by this series. The original completion handler also obtained
the CQ pointer and dereferenced it without a corresponding reclamation
grace period.

The reader changes here serve a different purpose: the acquire-load of
gc->cq_table pairs with HWC's release-publication of the initialized table
and its bound, while the NULL checks handle an unpublished table or entry.
They do not provide lifetime protection for an Ethernet CQ that another
CPU has already obtained from the table.

For HWC specifically, this patch destroys its dedicated EQ before freeing
the CQ and callback state. EQ deregistration removes the EQ from the IRQ
dispatch list and calls synchronize_rcu(), draining the existing IRQ-side
readers before the HWC CQ is released. This does not protect the separate
Ethernet CQ teardown path described in the report.

The reported CQ-destruction path is fixed in an independent MANA queue-set
replacement series that I plan to post shortly. That change unpublishes
the exact CQ pointer and waits for existing IRQ-side RCU readers before
the CQ is freed. It adds teardown-side synchronization without adding
per-completion reference counting.

I am keeping that pre-existing-bug fix in the independent series rather
than expanding the scope of this HWC concurrency and queue-depth series.

Thanks,
Wei

  parent reply	other threads:[~2026-10-09 11:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 12:53 [PATCH net-next v6 0/4] net: mana: concurrent HWC requests and dynamic queue depth Wei Hu
2026-10-07 12:53 ` [PATCH net-next v6 1/4] net: mana: prepare HWC ownership for safe reinitialization Wei Hu
     [not found]   ` <sashiko-outbox-164177@kernel.org>
2026-10-09 11:20     ` Wei Hu [this message]
2026-10-07 12:53 ` [PATCH net-next v6 2/4] net: mana: give each HWC message slot its own completion state Wei Hu
2026-10-07 12:53 ` [PATCH net-next v6 3/4] net: mana: support concurrent HWC requests Wei Hu
2026-10-07 12:53 ` [PATCH net-next v6 4/4] net: mana: add dynamic HWC queue depth with reinit path Wei Hu
2026-10-09 15:19 ` [PATCH net-next v6 0/4] net: mana: concurrent HWC requests and dynamic queue depth Simon Horman

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=20261009112006.591265-1-weh@linux.microsoft.com \
    --to=weh@linux.microsoft.com \
    --cc=kuba@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=weh@microsoft.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox