From: "Rao, Nikhil" <nikhirao@amd.com>
To: Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, brett.creeley@amd.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, eric.joyner@amd.com,
"Nikhil P. Rao" <nikhil.rao@amd.com>
Subject: Re: [PATCH v4 1/6] pds_core: add support for quiet devcmd failures
Date: Mon, 15 Jun 2026 11:53:50 -0700 [thread overview]
Message-ID: <8ac935d1-664b-4a70-a2e3-dbc6a3bc7243@amd.com> (raw)
In-Reply-To: <20260615153400.772876-3-horms@kernel.org>
On 6/15/2026 8:34 AM, Simon Horman wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> Full review at: https://sashiko.dev
> ---
> pds_core: add support for quiet devcmd failures
>
> This commit introduces support for suppressing error messages during device
> commands by adding a boolean parameter to wait and lock functions. It changes
> pdsc_devcmd_wait and pdsc_devcmd_locked into internal __pdsc_devcmd_wait and
> __pdsc_devcmd_locked variants that handle the new messaging flag. This
> functionality is intended for negotiating the PDS_CORE_IDENTITY_VERSION_2.
>
>> diff --git a/drivers/net/ethernet/amd/pds_core/dev.c b/drivers/net/ethernet/amd/pds_core/dev.c
>> index bded6b33289ce..dd9989cfe6b3f 100644
>> --- a/drivers/net/ethernet/amd/pds_core/dev.c
>> +++ b/drivers/net/ethernet/amd/pds_core/dev.c
>
> [ ... ]
>
>> -int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
>> - union pds_core_dev_comp *comp, int max_seconds)
>> +static int __pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
>> + union pds_core_dev_comp *comp, int max_seconds,
>> + const bool do_msg)
>> {
>> int err;
>>
>> @@ -197,7 +199,7 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
>>
>> memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
>> pdsc_devcmd_dbell(pdsc);
>> - err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
>> + err = __pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds, do_msg);
>>
>> if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)
>> queue_work(pdsc->wq, &pdsc->health_work);
>
> [Severity: Critical]
> This isn't a bug introduced by this patch, but it occurs in the function
> modified here.
>
> Can this queue_work() call trigger a use-after-free during driver removal?
>
> Looking at pdsc_remove() in drivers/net/ethernet/amd/pds_core/main.c,
> destroy_workqueue() is called but the pdsc->wq pointer is not cleared:
>
> pdsc_remove() {
> ...
> if (pdsc->wq)
> destroy_workqueue(pdsc->wq);
>
> mutex_lock(&pdsc->config_lock);
> set_bit(PDSC_S_STOPPING_DRIVER, &pdsc->state);
>
> pdsc_stop(pdsc);
> pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING);
> ...
> }
>
> Subsequently, pdsc_teardown() issues a RESET command to the firmware.
> If the firmware is unresponsive and the command times out, we reach this
> error path in __pdsc_devcmd_locked(). Since the pdsc->wq pointer was never
> set to NULL, the check here succeeds, and it attempts to queue work to a
> destroyed workqueue.
>
> Should pdsc->wq be explicitly set to NULL immediately after being destroyed
> in pdsc_remove() to prevent this?
Yes, this is a valid bug. I've already submitted a fix for this
(Message-ID: 20260610025952.196470-1-nikhil.rao@amd.com)
The initial fix sets pdsc->wq = NULL after destruction, but sashiko
raised a valid concern about a NotifyQ ISR race window.
This is a pre-existing bug not introduced by this series, so I'll submit
the reworked fix separately to -net.
Nikhil
next prev parent reply other threads:[~2026-06-15 18:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-14 5:00 [PATCH net-next v4 0/6] pds_core: Add PLDM firmware update and host backed memory support Nikhil P. Rao
2026-06-14 5:00 ` [PATCH v4 1/6] pds_core: add support for quiet devcmd failures Nikhil P. Rao
2026-06-15 15:34 ` Simon Horman
2026-06-15 15:37 ` Simon Horman
2026-06-15 18:53 ` Rao, Nikhil [this message]
2026-06-14 5:00 ` [PATCH v4 2/6] pds_core: add support for identity version 2 Nikhil P. Rao
2026-06-14 5:00 ` [PATCH v4 3/6] pds_core: add PLDM firmware update support via devlink flash Nikhil P. Rao
2026-06-15 15:36 ` Simon Horman
2026-06-15 19:04 ` Rao, Nikhil
2026-06-14 5:00 ` [PATCH v4 4/6] pds_core: add PLDM component info display Nikhil P. Rao
2026-06-15 16:08 ` Simon Horman
2026-06-15 19:58 ` Rao, Nikhil
2026-06-14 5:00 ` [PATCH v4 5/6] pds_core: add host backed memory support for firmware Nikhil P. Rao
2026-06-15 16:19 ` Simon Horman
2026-06-15 20:07 ` Rao, Nikhil
2026-06-14 5:00 ` [PATCH v4 6/6] pds_core: add debugfs support for host backed memory Nikhil P. Rao
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=8ac935d1-664b-4a70-a2e3-dbc6a3bc7243@amd.com \
--to=nikhirao@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.joyner@amd.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikhil.rao@amd.com \
--cc=pabeni@redhat.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