* [PATCH] pasemi: fix PCI device reference leaks in pas_setup_mce_regs
@ 2025-09-02 7:21 Miaoqian Lin
2025-09-02 10:24 ` Markus Elfring
0 siblings, 1 reply; 5+ messages in thread
From: Miaoqian Lin @ 2025-09-02 7:21 UTC (permalink / raw)
To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Jiri Slaby (SUSE), Miaoqian Lin,
Thomas Gleixner, Paul Mackerras, Olof Johansson, linuxppc-dev,
linux-kernel
Cc: stable
Fix reference leaks where PCI device references
obtained via pci_get_device() were not being released:
1. The while loop that iterates through 0xa00a devices was not
releasing the final device reference when the loop terminates.
2. Single device lookups for 0xa001 and 0xa009 devices were not
releasing their references after use.
Add missing pci_dev_put() calls to ensure all device references
are properly released.
Fixes: cd7834167ffb ("[POWERPC] pasemi: Print more information at machine check")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
arch/powerpc/platforms/pasemi/setup.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index d03b41336901..dafbee3afd86 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -169,6 +169,8 @@ static int __init pas_setup_mce_regs(void)
dev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa00a, dev);
reg++;
}
+ /* Release the last device reference from the while loop */
+ pci_dev_put(dev);
dev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL);
if (dev && reg+4 < MAX_MCE_REGS) {
@@ -185,6 +187,7 @@ static int __init pas_setup_mce_regs(void)
mce_regs[reg].addr = pasemi_pci_getcfgaddr(dev, 0xc1c);
reg++;
}
+ pci_dev_put(dev);
dev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa009, NULL);
if (dev && reg+2 < MAX_MCE_REGS) {
@@ -195,6 +198,7 @@ static int __init pas_setup_mce_regs(void)
mce_regs[reg].addr = pasemi_pci_getcfgaddr(dev, 0x214);
reg++;
}
+ pci_dev_put(dev);
num_mce_regs = reg;
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] pasemi: fix PCI device reference leaks in pas_setup_mce_regs
2025-09-02 7:21 [PATCH] pasemi: fix PCI device reference leaks in pas_setup_mce_regs Miaoqian Lin
@ 2025-09-02 10:24 ` Markus Elfring
2025-09-02 10:35 ` Jiri Slaby
2025-09-02 11:11 ` [PATCH] " Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: Markus Elfring @ 2025-09-02 10:24 UTC (permalink / raw)
To: Miaoqian Lin, linuxppc-dev
Cc: stable, LKML, Christophe Leroy, Jiri Slaby, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Olof Johansson, Paul Mackerras,
Thomas Gleixner
…
> Add missing pci_dev_put() calls to ensure all device references
> are properly released.
* See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc4#n658
* Would you like to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180
* How do you think about to append parentheses to the function name
in the summary phrase?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pasemi: fix PCI device reference leaks in pas_setup_mce_regs
2025-09-02 10:24 ` Markus Elfring
@ 2025-09-02 10:35 ` Jiri Slaby
2025-09-02 10:51 ` Markus Elfring
2025-09-02 11:11 ` [PATCH] " Greg KH
1 sibling, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2025-09-02 10:35 UTC (permalink / raw)
To: Markus Elfring, Miaoqian Lin, linuxppc-dev
Cc: stable, LKML, Christophe Leroy, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Olof Johansson, Paul Mackerras,
Thomas Gleixner
On 02. 09. 25, 12:24, Markus Elfring wrote:
> …
>> Add missing pci_dev_put() calls to ensure all device references
>> are properly released.
>
> * See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc4#n658
?
> * Would you like to increase the application of scope-based resource management?
> https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180
That won't work here at all.
--
js
suse labs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: pasemi: fix PCI device reference leaks in pas_setup_mce_regs
2025-09-02 10:35 ` Jiri Slaby
@ 2025-09-02 10:51 ` Markus Elfring
0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2025-09-02 10:51 UTC (permalink / raw)
To: Jiri Slaby, Miaoqian Lin, linuxppc-dev
Cc: stable, LKML, Christophe Leroy, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Olof Johansson, Paul Mackerras,
Thomas Gleixner
>> * Would you like to increase the application of scope-based resource management?
>> https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180
>
> That won't work here at all.
Why do you think in this direction here?
Regards,
Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pasemi: fix PCI device reference leaks in pas_setup_mce_regs
2025-09-02 10:24 ` Markus Elfring
2025-09-02 10:35 ` Jiri Slaby
@ 2025-09-02 11:11 ` Greg KH
1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2025-09-02 11:11 UTC (permalink / raw)
To: Markus Elfring
Cc: Miaoqian Lin, linuxppc-dev, stable, LKML, Christophe Leroy,
Jiri Slaby, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Olof Johansson, Paul Mackerras, Thomas Gleixner
On Tue, Sep 02, 2025 at 12:24:11PM +0200, Markus Elfring wrote:
> …
> > Add missing pci_dev_put() calls to ensure all device references
> > are properly released.
>
> * See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc4#n658
>
> * Would you like to increase the application of scope-based resource management?
> https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180
>
> * How do you think about to append parentheses to the function name
> in the summary phrase?
Hi,
This is the semi-friendly patch-bot of Greg Kroah-Hartman.
Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list. I strongly suggest that you not do this anymore. Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.
Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all. The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback. Please feel free to also ignore emails
from them.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-02 11:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 7:21 [PATCH] pasemi: fix PCI device reference leaks in pas_setup_mce_regs Miaoqian Lin
2025-09-02 10:24 ` Markus Elfring
2025-09-02 10:35 ` Jiri Slaby
2025-09-02 10:51 ` Markus Elfring
2025-09-02 11:11 ` [PATCH] " Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).