All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: nikhil.rao@amd.com
Cc: Simon Horman <horms@kernel.org>,
	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
Subject: Re: [PATCH v4 3/6] pds_core: add PLDM firmware update support via devlink flash
Date: Mon, 15 Jun 2026 16:36:19 +0100	[thread overview]
Message-ID: <20260615153620.775599-1-horms@kernel.org> (raw)
In-Reply-To: <20260614050052.1048328-4-nikhil.rao@amd.com>

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 PLDM firmware update support via devlink flash

Implement PLDM FW Update in the pds_core driver using the upstream
pldmfw API. This allows updating an entire PLDM FW package at once
or updating specific firmware components by name.

> diff --git a/drivers/net/ethernet/amd/pds_core/fw.c b/drivers/net/ethernet/amd/pds_core/fw.c
> --- a/drivers/net/ethernet/amd/pds_core/fw.c
> +++ b/drivers/net/ethernet/amd/pds_core/fw.c
> [ ... ]
> @@ -195,3 +239,720 @@ int pdsc_firmware_update(struct pdsc *pdsc, const struct firmware *fw,
> [ ... ]
> +static int pdsc_flash_component_chunk(struct pdsc *pdsc, struct device *dev,
> [ ... ]
> +	err = pdsc_devcmd_send_component(pdsc, info, info_sz, dma_addr,
> +					 copy_sz, offset, slot_id, comp);
> +	if (err == -ETIMEDOUT || err == -EAGAIN) {
> +		pdsc_deferred_dma_add(pdsc, deferred, dma_addr,
> +				      component_data, copy_sz, DMA_TO_DEVICE);
> +		return err;
> +	}

[Severity: High]
Can this lead to a race condition that leaks the DMA mapping and memory?

If pdsc_devcmd_send_component() encounters a timeout in the lower level
__pdsc_devcmd_locked() function, it will queue pdsc->health_work. The wrapper
function __pdsc_devcmd_with_data_nomsg() will then release the devcmd_lock
before returning the timeout error back here.

If the scheduled health_work runs and acquires devcmd_lock before this code
reaches pdsc_deferred_dma_add(), it could execute a recovery devcmd and
call pdsc_deferred_dma_free() on an empty list. When this thread resumes,
it adds the timed-out buffer to the deferred DMA list, but its cleanup
trigger has already fired, leaving the buffer leaked.

> [ ... ]
> +int pdsc_firmware_update(struct pdsc *pdsc,
> +			 struct devlink_flash_update_params *params,
> +			 struct netlink_ext_ack *extack)
> +{
> +	int err;
> +
> +	if (pdsc->dev_ident.version >= PDS_CORE_IDENTITY_VERSION_2 &&
> +	    pdsc->dev_ident.capabilities &
> +		cpu_to_le64(PDS_CORE_DEV_CAP_PLDM_FW_UPDATE))
> +		err = pdsc_pldm_firmware_update(pdsc, params, extack,
> +						params->fw);
> +	else
> +		err = pdsc_legacy_firmware_update(pdsc, params->fw, extack);

[Severity: High]
Does this fallback path ignore the requested component name?

If the device does not support PLDM, the driver falls back to
pdsc_legacy_firmware_update() which only takes the params->fw pointer.
If a user requested a targeted component update using devlink, this would
ignore the component filter and flash the entire monolithic image onto
the device.

Should this explicitly check if params->component is set before falling
back, and return -EOPNOTSUPP if a component is specified on legacy
firmware?

  reply	other threads:[~2026-06-15 15:36 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
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 [this message]
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=20260615153620.775599-1-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.joyner@amd.com \
    --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 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.