* [PATCH v2 0/2] net: ena: fix resource cleanup on probe failure
@ 2026-09-21 15:42 Guangshuo Li
2026-09-21 15:42 ` [PATCH v2 1/2] net: ena: fix PHC " Guangshuo Li
2026-09-21 15:42 ` [PATCH v2 2/2] net: ena: fix MMIO read buffer leak " Guangshuo Li
0 siblings, 2 replies; 6+ messages in thread
From: Guangshuo Li @ 2026-09-21 15:42 UTC (permalink / raw)
To: Arthur Kiyanovski, David Arinzon, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Guangshuo Li,
Ioana Ciornei, Sang-Heon Jeon, Dawei Feng, Amit Bernstein,
Netanel Belgazal, netdev, linux-kernel
This series fixes two resource leaks in the ena_probe() error path after
ena_device_init() has successfully initialized device resources.
Patch 1 adds the missing PHC cleanup.
Patch 2 adds the missing MMIO read request cleanup.
v2:
- Resend the PHC and MMIO cleanup fixes as a two-patch series, as
requested by Arthur Kiyanovski.
Guangshuo Li (2):
net: ena: fix PHC cleanup on probe failure
net: ena: fix MMIO read buffer leak on probe failure
drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 ++
1 file changed, 2 insertions(+)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] net: ena: fix PHC cleanup on probe failure
2026-09-21 15:42 [PATCH v2 0/2] net: ena: fix resource cleanup on probe failure Guangshuo Li
@ 2026-09-21 15:42 ` Guangshuo Li
2026-09-21 19:06 ` Arthur Kiyanovski
2026-09-21 15:42 ` [PATCH v2 2/2] net: ena: fix MMIO read buffer leak " Guangshuo Li
1 sibling, 1 reply; 6+ messages in thread
From: Guangshuo Li @ 2026-09-21 15:42 UTC (permalink / raw)
To: Arthur Kiyanovski, David Arinzon, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Guangshuo Li,
Ioana Ciornei, Sang-Heon Jeon, Dawei Feng, Amit Bernstein,
Netanel Belgazal, netdev, linux-kernel
Cc: stable
ena_probe() initializes the PHC as part of ena_device_init(), but the
probe failure path does not destroy it before freeing the PHC private
data.
The normal removal path calls ena_phc_destroy() through
ena_destroy_device() before ena_phc_free(). However, if probe fails
after ena_device_init() succeeds, the error path reaches ena_phc_free()
without unregistering the PTP clock or destroying the device PHC
resources.
Call ena_phc_destroy() in the probe error path before freeing the PHC
private data.
This issue was found by manual code inspection.
Fixes: e0ea34158ee8 ("net: ena: Add PHC support in the ENA driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index ea89619039d8..5f0864d16dd3 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -4122,6 +4122,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err_device_destroy:
ena_com_delete_host_info(ena_dev);
ena_com_admin_destroy(ena_dev);
+ ena_phc_destroy(adapter);
ena_devlink_destroy:
ena_devlink_free(devlink);
err_metrics_destroy:
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] net: ena: fix MMIO read buffer leak on probe failure
2026-09-21 15:42 [PATCH v2 0/2] net: ena: fix resource cleanup on probe failure Guangshuo Li
2026-09-21 15:42 ` [PATCH v2 1/2] net: ena: fix PHC " Guangshuo Li
@ 2026-09-21 15:42 ` Guangshuo Li
1 sibling, 0 replies; 6+ messages in thread
From: Guangshuo Li @ 2026-09-21 15:42 UTC (permalink / raw)
To: Arthur Kiyanovski, David Arinzon, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Guangshuo Li,
Ioana Ciornei, Sang-Heon Jeon, Dawei Feng, Amit Bernstein,
Netanel Belgazal, netdev, linux-kernel
Cc: stable
ena_device_init() initializes the MMIO read mechanism with
ena_com_mmio_reg_read_request_init(), which allocates a coherent DMA
buffer for MMIO read responses.
The normal removal path releases this buffer through
ena_com_mmio_reg_read_request_destroy(). However, if ena_probe() fails
after ena_device_init() succeeds, the error path destroys the admin
resources and eventually frees ena_dev without destroying the MMIO read
request, leaving the coherent DMA buffer allocated.
Call ena_com_mmio_reg_read_request_destroy() in the probe error path
before releasing the remaining device resources.
This issue was found by manual code inspection.
Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 5f0864d16dd3..7eb6456ed0d5 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -4123,6 +4123,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ena_com_delete_host_info(ena_dev);
ena_com_admin_destroy(ena_dev);
ena_phc_destroy(adapter);
+ ena_com_mmio_reg_read_request_destroy(ena_dev);
ena_devlink_destroy:
ena_devlink_free(devlink);
err_metrics_destroy:
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: ena: fix PHC cleanup on probe failure
2026-09-21 15:42 ` [PATCH v2 1/2] net: ena: fix PHC " Guangshuo Li
@ 2026-09-21 19:06 ` Arthur Kiyanovski
2026-09-21 22:02 ` Krzysztof Kozlowski
0 siblings, 1 reply; 6+ messages in thread
From: Arthur Kiyanovski @ 2026-09-21 19:06 UTC (permalink / raw)
To: Guangshuo Li
Cc: Arthur Kiyanovski, David Arinzon, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Ioana Ciornei,
Sang-Heon Jeon, Dawei Feng, Amit Bernstein, Netanel Belgazal,
netdev, linux-kernel, stable
On Mon, 21 Sep 2026 23:42:01 +0800, Guangshuo Li <lgs201920130244@gmail.com> wrote:
> ena_probe() initializes the PHC as part of ena_device_init(), but the
> probe failure path does not destroy it before freeing the PHC private
> data.
>
> The normal removal path calls ena_phc_destroy() through
> ena_destroy_device() before ena_phc_free(). However, if probe fails
> after ena_device_init() succeeds, the error path reaches ena_phc_free()
This part:
> without unregistering the PTP clock or destroying the device PHC
> resources.
is inaccurate, see my explanation bellow.
>
>
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index ea89619039d8..5f0864d16dd3 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -4122,6 +4122,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> err_device_destroy:
> ena_com_delete_host_info(ena_dev);
> ena_com_admin_destroy(ena_dev);
> + ena_phc_destroy(adapter);
> ena_devlink_destroy:
> ena_devlink_free(devlink);
> err_metrics_destroy:
Thanks for resending as a series - the split and the ordering are what I
asked for.
But v2 doesn't address Sashiko's review of v1.
PHC is off during an initial probe. It only turns on if the user enables
it via devlink, and devlink is registered at the very end of a successful
ena_probe(). So on this error path phc_info->clock and
ena_dev->phc.virt_addr are both NULL and ena_phc_destroy() does nothing.
I still want the call - it keeps the probe unwind symmetric with
ena_destroy_device() - but it is a robustness change, not a fix. Please
drop Fixes: and Cc: stable, and say so in the commit message, for
example:
No functional change: PHC is always disabled during an initial probe,
so this only keeps the probe unwind symmetric.
Since net is for fixes, that means splitting after all - sorry for the
extra round trip:
- the MMIO read buffer fix goes to net on its own, keeping Fixes: and
- this patch goes to net-next, without Fixes: or Cc: stable
The MMIO fix has to land in net and propagate into net-next before you
post this one, otherwise you hit the same hunk conflict again.
Also please use --subject-prefix='PATCH net-next v3';
netdev/series_format is still warning that the target tree isn't
specified in the subject.
Thank you.
Cc: stable
Cc: stable
--
Arthur Kiyanovski <akiyano@amazon.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: ena: fix PHC cleanup on probe failure
2026-09-21 19:06 ` Arthur Kiyanovski
@ 2026-09-21 22:02 ` Krzysztof Kozlowski
2026-09-22 2:12 ` Guangshuo Li
0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-21 22:02 UTC (permalink / raw)
To: Arthur Kiyanovski, Guangshuo Li
Cc: David Arinzon, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Ioana Ciornei, Sang-Heon Jeon,
Dawei Feng, Amit Bernstein, Netanel Belgazal, netdev,
linux-kernel, stable
On 21/09/2026 21:06, Arthur Kiyanovski wrote:
> On Mon, 21 Sep 2026 23:42:01 +0800, Guangshuo Li <lgs201920130244@gmail.com> wrote:
>> ena_probe() initializes the PHC as part of ena_device_init(), but the
>> probe failure path does not destroy it before freeing the PHC private
>> data.
>>
>> The normal removal path calls ena_phc_destroy() through
>> ena_destroy_device() before ena_phc_free(). However, if probe fails
>> after ena_device_init() succeeds, the error path reaches ena_phc_free()
>
> This part:
>
>> without unregistering the PTP clock or destroying the device PHC
>> resources.
>
> is inaccurate, see my explanation bellow.
>
Don't waste your time. This is AI slop agent posting (one of 500 more of
postings where agent does not care about replies).
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: ena: fix PHC cleanup on probe failure
2026-09-21 22:02 ` Krzysztof Kozlowski
@ 2026-09-22 2:12 ` Guangshuo Li
0 siblings, 0 replies; 6+ messages in thread
From: Guangshuo Li @ 2026-09-22 2:12 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Arthur Kiyanovski, David Arinzon, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Ioana Ciornei,
Sang-Heon Jeon, Dawei Feng, Amit Bernstein, Netanel Belgazal,
netdev, linux-kernel, stable
Hi Krzysztof,
Thank you for your feedback.
On Tue, 22 Sept 2026 at 06:02, Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 21/09/2026 21:06, Arthur Kiyanovski wrote:
> > On Mon, 21 Sep 2026 23:42:01 +0800, Guangshuo Li <lgs201920130244@gmail.com> wrote:
> >> ena_probe() initializes the PHC as part of ena_device_init(), but the
> >> probe failure path does not destroy it before freeing the PHC private
> >> data.
> >>
> >> The normal removal path calls ena_phc_destroy() through
> >> ena_destroy_device() before ena_phc_free(). However, if probe fails
> >> after ena_device_init() succeeds, the error path reaches ena_phc_free()
> >
> > This part:
> >
> >> without unregistering the PTP clock or destroying the device PHC
> >> resources.
> >
> > is inaccurate, see my explanation bellow.
> >
>
> Don't waste your time. This is AI slop agent posting (one of 500 more of
> postings where agent does not care about replies).
>
> Best regards,
> Krzysztof
I would like to clarify that these patches were manually reviewed and
audited by us; they were not simply generated and submitted by an LLM.
However, I understand why the recent submission pattern may have given
that impression. We sent too many patches in a short period of time,
and we also failed to respond to some discussions in a timely manner,
which made the situation look worse.
Many of the recent patches, especially the v2 revisions, are
corrections and improvements based on previous review feedback rather
than completely new untested changes. That said, we recognize that the
way we submitted them increased the burden on maintainers and
reviewers.
We apologize for the pressure this caused to the community. We will be
more careful about organizing patches by subsystem, preparing proper
patchsets, and following the kernel contribution guidelines before
sending future work.
Thank you again for pointing this out.
Best regards,
Guangshuo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-22 2:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 15:42 [PATCH v2 0/2] net: ena: fix resource cleanup on probe failure Guangshuo Li
2026-09-21 15:42 ` [PATCH v2 1/2] net: ena: fix PHC " Guangshuo Li
2026-09-21 19:06 ` Arthur Kiyanovski
2026-09-21 22:02 ` Krzysztof Kozlowski
2026-09-22 2:12 ` Guangshuo Li
2026-09-21 15:42 ` [PATCH v2 2/2] net: ena: fix MMIO read buffer leak " Guangshuo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®