* [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk()
@ 2026-11-03 10:42 Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wentao Liang @ 2026-11-03 10:42 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas
Cc: linux-pci, linux-kernel, Wentao Liang, stable
pci_get_host_bridge_device() takes a kobject reference on the host
bridge device. ks_pcie_quirk() returns without releasing it on every
path after the lookup, including the AM654 PG1.0 path that only limits
the MRRS, so the reference is leaked once for each enabled downstream
device below an AM654 root complex.
Move the AM654 handling out of the enclosing conditional and release
the reference through a single cleanup label.
Fixes: 86f271f22bbb ("PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0)")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/pci/controller/dwc/pci-keystone.c | 45 +++++++++++++----------
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index edfbc32904cd..0c46887de0d5 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -579,26 +579,33 @@ static void ks_pcie_quirk(struct pci_dev *dev)
* when MRRS is set to more than 128 bytes. Force the MRRS to
* 128 bytes in all downstream devices.
*/
- if (pci_match_id(am6_pci_devids, bridge)) {
- bridge_dev = pci_get_host_bridge_device(dev);
- if (!bridge_dev || !bridge_dev->parent)
- return;
-
- ks_pcie = dev_get_drvdata(bridge_dev->parent);
- if (!ks_pcie)
- return;
-
- val = ks_pcie_app_readl(ks_pcie, PID);
- val &= RTL;
- val >>= RTL_SHIFT;
- if (val != AM6_PCI_PG1_RTL_VER)
- return;
-
- if (pcie_get_readrq(dev) > 128) {
- dev_info(&dev->dev, "limiting MRRS to 128 bytes\n");
- pcie_set_readrq(dev, 128);
- }
+ if (!pci_match_id(am6_pci_devids, bridge))
+ return;
+
+ bridge_dev = pci_get_host_bridge_device(dev);
+ if (!bridge_dev)
+ return;
+
+ if (!bridge_dev->parent)
+ goto put_bridge;
+
+ ks_pcie = dev_get_drvdata(bridge_dev->parent);
+ if (!ks_pcie)
+ goto put_bridge;
+
+ val = ks_pcie_app_readl(ks_pcie, PID);
+ val &= RTL;
+ val >>= RTL_SHIFT;
+ if (val != AM6_PCI_PG1_RTL_VER)
+ goto put_bridge;
+
+ if (pcie_get_readrq(dev) > 128) {
+ dev_info(&dev->dev, "limiting MRRS to 128 bytes\n");
+ pcie_set_readrq(dev, 128);
}
+
+put_bridge:
+ pci_put_host_bridge_device(bridge_dev);
}
DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, ks_pcie_quirk);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk()
2026-11-03 10:42 [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk() Wentao Liang
@ 2026-11-03 11:10 ` Krzysztof Kozlowski
2026-11-03 23:33 ` kernel test robot
2026-11-05 15:45 ` sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-03 11:10 UTC (permalink / raw)
To: Wentao Liang
Cc: Lorenzo Pieralisi, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, stable, Krzysztof Wilczyński, linux-pci,
linux-kernel
On Tue, 03 Nov 2026 10:42:39 +0000, Wentao Liang wrote:
> pci_get_host_bridge_device() takes a kobject reference on the host
> bridge device. ks_pcie_quirk() returns without releasing it on every
> path after the lookup, including the AM654 PG1.0 path that only limits
> the MRRS, so the reference is leaked once for each enabled downstream
> device below an AM654 root complex.
>
> Move the AM654 handling out of the enclosing conditional and release
> the reference through a single cleanup label.
>
> Fixes: 86f271f22bbb ("PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0)")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/pci/controller/dwc/pci-keystone.c | 45 +++++++++++++----------
> 1 file changed, 26 insertions(+), 19 deletions(-)
>
Multiple things here:
1. Your team ignored completely previous feedback. Multiple times.
2. You use multiple identities with this email address, thus I doubt that we
speak with an actual person.
3. Your bot does not even bother running checkpatch, right?
4. Nothing of this was reproduced nor tested.
5. Finally, the same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document the issue discovery method and what was
or was not tested.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk()
2026-11-03 10:42 [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk() Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
@ 2026-11-03 23:33 ` kernel test robot
2026-11-05 15:45 ` sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-11-03 23:33 UTC (permalink / raw)
To: Wentao Liang, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas
Cc: oe-kbuild-all, linux-pci, linux-kernel, Wentao Liang, stable
Hi Wentao,
kernel test robot noticed the following build errors:
[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus linus/master v7.3 next-20261030]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Wentao-Liang/PCI-keystone-drop-host-bridge-reference-in-ks_pcie_quirk/20261103-104239
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20261103104239.1373754-1-vulab%40iscas.ac.cn
patch subject: [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk()
config: riscv-randconfig-1000-20261103 (https://download.01.org/0day-ci/archive/20261104/202611040751.abETm1WS-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261104/202611040751.abETm1WS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611040751.abETm1WS-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: drivers/pci/controller/dwc/pci-keystone.ko: symbol 'pci_put_host_bridge_device' undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk()
2026-11-03 10:42 [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk() Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
2026-11-03 23:33 ` kernel test robot
@ 2026-11-05 15:45 ` sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-05 15:45 UTC (permalink / raw)
To: Wentao Liang; +Cc: linux-pci
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] PCI: keystone: unexported pci_put_host_bridge_device() breaks module build
--
commit 7a2a6fc28bf725e307c0f83095897f6ac6b29cc8
Author: Wentao Liang <vulab@iscas.ac.cn>
PCI: keystone: drop host bridge reference in ks_pcie_quirk()
This commit fixes a host bridge device reference leak in ks_pcie_quirk() by
calling pci_put_host_bridge_device() via a cleanup label on all exit paths
after pci_get_host_bridge_device().
> diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
> index edfbc32904cda..0c46887de0d5d 100644
> --- a/drivers/pci/controller/dwc/pci-keystone.c
> +++ b/drivers/pci/controller/dwc/pci-keystone.c
> @@ -579,26 +579,33 @@ static void ks_pcie_quirk(struct pci_dev *dev)
> * when MRRS is set to more than 128 bytes. Force the MRRS to
> * 128 bytes in all downstream devices.
> */
> - if (pci_match_id(am6_pci_devids, bridge)) {
> - bridge_dev = pci_get_host_bridge_device(dev);
> - if (!bridge_dev || !bridge_dev->parent)
> - return;
> -
> - ks_pcie = dev_get_drvdata(bridge_dev->parent);
> - if (!ks_pcie)
> - return;
> -
> - val = ks_pcie_app_readl(ks_pcie, PID);
> - val &= RTL;
> - val >>= RTL_SHIFT;
> - if (val != AM6_PCI_PG1_RTL_VER)
> - return;
> -
> - if (pcie_get_readrq(dev) > 128) {
> - dev_info(&dev->dev, "limiting MRRS to 128 bytes\n");
> - pcie_set_readrq(dev, 128);
> - }
> + if (!pci_match_id(am6_pci_devids, bridge))
> + return;
> +
> + bridge_dev = pci_get_host_bridge_device(dev);
> + if (!bridge_dev)
> + return;
> +
> + if (!bridge_dev->parent)
> + goto put_bridge;
> +
> + ks_pcie = dev_get_drvdata(bridge_dev->parent);
> + if (!ks_pcie)
> + goto put_bridge;
> +
> + val = ks_pcie_app_readl(ks_pcie, PID);
> + val &= RTL;
> + val >>= RTL_SHIFT;
> + if (val != AM6_PCI_PG1_RTL_VER)
> + goto put_bridge;
> +
> + if (pcie_get_readrq(dev) > 128) {
> + dev_info(&dev->dev, "limiting MRRS to 128 bytes\n");
> + pcie_set_readrq(dev, 128);
> }
> +
> +put_bridge:
> + pci_put_host_bridge_device(bridge_dev);
> }
[Severity: Low]
Will calling pci_put_host_bridge_device() here break the module build when
CONFIG_PCI_KEYSTONE_HOST=m or CONFIG_PCI_KEYSTONE_EP=m on non-ARM32 targets
(which selects CONFIG_PCI_KEYSTONE_TRISTATE=m)?
In drivers/pci/host-bridge.c, pci_get_host_bridge_device() is exported for
modules, but pci_put_host_bridge_device() is not:
drivers/pci/host-bridge.c:
struct device *pci_get_host_bridge_device(struct pci_dev *dev)
{
...
}
EXPORT_SYMBOL_GPL(pci_get_host_bridge_device);
void pci_put_host_bridge_device(struct device *dev)
{
kobject_put(&dev->kobj);
}
Additionally, pci_put_host_bridge_device() is currently only declared in the
internal header drivers/pci/pci.h rather than include/linux/pci.h alongside
pci_get_host_bridge_device().
Should pci_put_host_bridge_device() be exported with EXPORT_SYMBOL_GPL() in
drivers/pci/host-bridge.c (and moved to include/linux/pci.h) so modular builds
of pci-keystone.ko do not fail at modpost?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103104239.1373754-1-vulab@iscas.ac.cn?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-05 15:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 10:42 [PATCH] PCI: keystone: drop host bridge reference in ks_pcie_quirk() Wentao Liang
2026-11-03 11:10 ` Krzysztof Kozlowski
2026-11-03 23:33 ` kernel test robot
2026-11-05 15:45 ` sashiko-bot
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.