Linux-HyperV List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Long Li" <longli@microsoft.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH] net: mana: Clear RDMA teardown and suspend state in mana_rdma_probe()
Date: Fri, 28 Aug 2026 00:00:32 +0000	[thread overview]
Message-ID: <20260828000033.2BC731F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260826235940.1869565-1-longli@microsoft.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Lockless access to `gd->adev` during probe causes hardware SUSPEND events to be silently dropped, leading to a state mismatch between the host and hardware.
--

commit a413863cad4d3b91f96dce2e01b3fa3e47e6054e
Author: Long Li <longli@microsoft.com>

net: mana: Clear RDMA teardown and suspend state in mana_rdma_probe()

This commit clears gd->rdma_teardown and gd->is_suspended during
mana_rdma_probe() to allow servicing events to be handled again after a reset
cycle. It uses smp_store_release() to publish the state before adding the
auxiliary device.

> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 7a1ac853e3abc..56f426da72864 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c

[ ... ]

> @@ -4279,6 +4280,17 @@ int mana_rdma_probe(struct gdma_dev *gd)
>  	if (err)
>  		return err;
>  
> +	/* Clear the state left by a previous mana_rdma_remove() so servicing
> +	 * events are handled again after a reset cycle.
> +	 */
> +	gd->is_suspended = false;
> +
> +	/* Publish is_suspended before re-opening the gate, so the handler
> +	 * cannot act on a stale value.  Pairs with the smp_load_acquire()
> +	 * in mana_rdma_service_handle().
> +	 */
> +	smp_store_release(&gd->rdma_teardown, false);
> +
>  	err = add_adev(gd, "rdma");

[Severity: High]
Could clearing the teardown flag before the auxiliary device is fully
initialized cause hardware suspend events to be silently dropped?

If a GDMA_SERVICE_TYPE_RDMA_SUSPEND event arrives from hardware immediately
after smp_store_release() clears gd->rdma_teardown, the handler in
mana_rdma_service_handle() will be able to process it.

However, because add_adev() has not yet completed and published gd->adev,
the lockless check in mana_rdma_service_handle() will see a NULL pointer:

mana_rdma_service_handle() {
        ...
        switch (serv_work->event) {
        case GDMA_SERVICE_TYPE_RDMA_SUSPEND:
                if (!gd->adev || gd->is_suspended)
                        break;
        ...
}

Will this result in the handler breaking out early and dropping the suspend
event locklessly, leading to a state mismatch between the host and hardware?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260826235940.1869565-1-longli@microsoft.com?part=1

  reply	other threads:[~2026-08-28  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 23:59 [PATCH] net: mana: Clear RDMA teardown and suspend state in mana_rdma_probe() Long Li
2026-08-28  0:00 ` sashiko-bot [this message]
2026-08-28  0:08   ` [EXTERNAL] " Long Li

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=20260828000033.2BC731F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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