All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Eric Joyner <eric.joyner@amd.com>, netdev@vger.kernel.org
Cc: Brett Creeley <brett.creeley@amd.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	"Nikhil P. Rao" <nikhil.rao@amd.com>,
	Eric Dumazet <edumazet@kernel.org>
Subject: Re: [PATCH net v2 2/2] ionic: free port_info when probe fails after the port is set up
Date: Fri, 16 Oct 2026 12:34:27 +0100	[thread overview]
Message-ID: <84d3e516-2e3a-4f0f-bc8f-b1be267f1bd0@linux.dev> (raw)
In-Reply-To: <20261015-ionic-port-info-lifetime-v2-2-57232013fd79@amd.com>

On 16/10/2026 00:03, Eric Joyner wrote:
> ionic_probe() allocates the port_info DMA buffer via ionic_setup_one()
> -> ionic_port_init(). If probe then fails anywhere after that, it
> unwinds through err_out_pci, which never calls ionic_port_reset();
> ionic_dev_teardown() and ionic_clear_pci() do not touch port_info, and
> so the buffer is leaked. The call was lost when the setup code was
> moved into ionic_setup_one().
> 
> Since ionic_remove() already frees the port_info DMA buffer with
> ionic_port_reset(), call that on the probe error path too. Every path
> to err_out_pci runs after ionic_setup_one() succeeded, so the BARs are
> still mapped and the firmware gets a PORT_RESET before the buffer is
> freed, the same order as in ionic_remove().
> 
> Fixes: 0de38d9f1dba ("ionic: extract common bits from ionic_probe")
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Eric Joyner <eric.joyner@amd.com>
> ---
>   drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> index 05f19489ec5c..68b3bceedd99 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
> @@ -397,6 +397,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   err_out_free_irqs:
>   	ionic_bus_free_irq_vectors(ionic);
>   err_out_pci:
> +	ionic_port_reset(ionic);
>   	ionic_dev_teardown(ionic);
>   	ionic_clear_pci(ionic);
>   	ionic_debugfs_del_dev(ionic);
> 
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2026-10-16 11:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 23:03 [PATCH net v2 0/2] ionic: fix port_info lifetime bugs Eric Joyner
2026-10-15 23:03 ` [PATCH net v2 1/2] ionic: fix port_info use-after-free on firmware recovery Eric Joyner
2026-10-16 11:17   ` Vadim Fedorenko
2026-10-15 23:03 ` [PATCH net v2 2/2] ionic: free port_info when probe fails after the port is set up Eric Joyner
2026-10-16 11:34   ` Vadim Fedorenko [this message]
2026-10-15 23:08 ` [PATCH net v2 0/2] ionic: fix port_info lifetime bugs netdev-bot+sinfo
2026-10-15 23:56   ` Eric Joyner

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=84d3e516-2e3a-4f0f-bc8f-b1be267f1bd0@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --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 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.