* [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops
@ 2026-12-03 17:16 Ian Rogers
2026-12-03 17:16 ` [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops Ian Rogers
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ian Rogers @ 2026-12-03 17:16 UTC (permalink / raw)
To: Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas
Cc: Rob Herring, Nathan Chancellor, linux-pci, llvm, linux-kernel,
Ian Rogers
pci_epc_get() / pci_epc_put() reference count epc->ops->owner, while
none of the four struct pci_epc_ops definitions under
drivers/pci/controller/ initialize .owner:
1. pcie-cadence-ep (tristate CONFIG_PCIE_CADENCE_EP) - fixes missing
module pinning when built as a module (has Fixes tag).
2. pcie-designware-ep, pcie-rcar-ep, and pcie-rockchip-ep (currently
bool) - initialized for consistency and to prepare for annotating
pci_epc_ops::owner with __must_init.
Tooling note: Found using Clang's require_explicit_initialization
attribute; an AI coding assistant helped audit call sites, verify Kconfig
module eligibility and Fixes commits, and draft the changelogs. All four
files were build-tested with LLVM=1.
Ian Rogers (2):
PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops
PCI: endpoint: Set .owner = THIS_MODULE in remaining pci_epc_ops
drivers/pci/controller/cadence/pcie-cadence-ep.c | 1 +
drivers/pci/controller/dwc/pcie-designware-ep.c | 2 ++
drivers/pci/controller/pcie-rcar-ep.c | 2 ++
drivers/pci/controller/pcie-rockchip-ep.c | 2 ++
4 files changed, 7 insertions(+)
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops 2026-12-03 17:16 [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops Ian Rogers @ 2026-12-03 17:16 ` Ian Rogers 2026-12-03 18:33 ` sashiko-bot 2026-12-03 17:16 ` Ian Rogers 2026-12-03 18:47 ` [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops sashiko-bot 2 siblings, 1 reply; 6+ messages in thread From: Ian Rogers @ 2026-12-03 17:16 UTC (permalink / raw) To: Manivannan Sadhasivam, Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas Cc: Rob Herring, Nathan Chancellor, linux-pci, llvm, linux-kernel, Ian Rogers, Aksh Garg, Cyrille Pitchen pci_epc_get() calls try_module_get(epc->ops->owner) and pci_epc_put() calls module_put(epc->ops->owner), while __pci_epc_create() ignores its owner parameter because epc->ops is const struct pci_epc_ops *. Because pcie-cadence-ep can be built as a module (CONFIG_PCIE_CADENCE_EP), omitting .owner leaves the module unpinned while an endpoint controller reference is held. Set .owner = THIS_MODULE in cdns_pcie_epc_ops, found with Clang's require_explicit_initialization attribute. Fixes: 37dddf14f1ae ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller") Signed-off-by: Ian Rogers <irogers@google.com> --- drivers/pci/controller/cadence/pcie-cadence-ep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c index a967f7762283..eda5e2da90db 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-ep.c +++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c @@ -648,6 +648,7 @@ static const struct pci_epc_ops cdns_pcie_epc_ops = { .map_msi_irq = cdns_pcie_ep_map_msi_irq, .start = cdns_pcie_ep_start, .get_features = cdns_pcie_ep_get_features, + .owner = THIS_MODULE, }; void cdns_pcie_ep_disable(struct cdns_pcie_ep *ep) -- 2.56.1.839.g22a8290db9-goog ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops 2026-12-03 17:16 ` [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops Ian Rogers @ 2026-12-03 18:33 ` sashiko-bot 0 siblings, 0 replies; 6+ messages in thread From: sashiko-bot @ 2026-12-03 18:33 UTC (permalink / raw) To: Ian Rogers; +Cc: linux-pci Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] PCI: cadence: Fixes tag cites 37dddf14f1ae instead of f876904e4436 -- commit 7d16f45d8dc004d424a29a6333f5e5299a95a021 Author: Ian Rogers <irogers@google.com> > PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops > > pci_epc_get() calls try_module_get(epc->ops->owner) and pci_epc_put() > calls module_put(epc->ops->owner), while __pci_epc_create() ignores its > owner parameter because epc->ops is const struct pci_epc_ops *. Because > pcie-cadence-ep can be built as a module (CONFIG_PCIE_CADENCE_EP), > omitting .owner leaves the module unpinned while an endpoint controller > reference is held. > > Set .owner = THIS_MODULE in cdns_pcie_epc_ops, found with Clang's > require_explicit_initialization attribute. > > Fixes: 37dddf14f1ae ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller") > Signed-off-by: Ian Rogers <irogers@google.com> [Severity: Low] Should the Fixes tag point to f876904e4436 ("PCI: cadence: Add support to build pcie-cadence library as a kernel module") instead? In the cited commit, CONFIG_PCIE_CADENCE_EP was bool and built-in only, so THIS_MODULE expanded to NULL. The unpinned-module bug began when the driver was converted to tristate, and citing the older commit can trigger unnecessary backports to stable trees where it cannot be built as a module. Fixes: f876904e4436 ("PCI: cadence: Add support to build pcie-cadence library as a kernel module") -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203171642.440891-1-irogers@google.com?part=1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] PCI: endpoint: Set .owner = THIS_MODULE in remaining pci_epc_ops 2026-12-03 17:16 [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops Ian Rogers @ 2026-12-03 17:16 ` Ian Rogers 2026-12-03 17:16 ` Ian Rogers 2026-12-03 18:47 ` [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops sashiko-bot 2 siblings, 0 replies; 6+ messages in thread From: Ian Rogers @ 2026-12-03 17:16 UTC (permalink / raw) To: Manivannan Sadhasivam, Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas Cc: Rob Herring, Nathan Chancellor, linux-pci, llvm, linux-kernel, Ian Rogers, Jingoo Han, Marek Vasut, Yoshihiro Shimoda, Geert Uytterhoeven, Magnus Damm, Shawn Lin, Heiko Stuebner, linux-renesas-soc, linux-rockchip, linux-arm-kernel pcie-designware-ep, pcie-rcar-ep, and pcie-rockchip-ep are currently bool Kconfig options (where THIS_MODULE is NULL), so omitting .owner in their struct pci_epc_ops definitions does not affect runtime module reference counting today. Initialize .owner = THIS_MODULE in all three for consistency across all struct pci_epc_ops definitions and to prepare for annotating pci_epc_ops::owner with Clang's require_explicit_initialization attribute. Signed-off-by: Ian Rogers <irogers@google.com> --- drivers/pci/controller/dwc/pcie-designware-ep.c | 2 ++ drivers/pci/controller/pcie-rcar-ep.c | 2 ++ drivers/pci/controller/pcie-rockchip-ep.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index e6060bb0bbbd..d5223597b5c9 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -8,6 +8,7 @@ #include <linux/align.h> #include <linux/bitfield.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/overflow.h> #include <linux/platform_device.h> @@ -949,6 +950,7 @@ static const struct pci_epc_ops epc_ops = { .get_features = dw_pcie_ep_get_features, .get_aux_resources_count = dw_pcie_ep_get_aux_resources_count, .get_aux_resources = dw_pcie_ep_get_aux_resources, + .owner = THIS_MODULE, }; /** diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c index e33c66caa1a6..b9df4699178c 100644 --- a/drivers/pci/controller/pcie-rcar-ep.c +++ b/drivers/pci/controller/pcie-rcar-ep.c @@ -7,6 +7,7 @@ */ #include <linux/delay.h> +#include <linux/module.h> #include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/pci.h> @@ -463,6 +464,7 @@ static const struct pci_epc_ops rcar_pcie_epc_ops = { .start = rcar_pcie_ep_start, .stop = rcar_pcie_ep_stop, .get_features = rcar_pcie_ep_get_features, + .owner = THIS_MODULE, }; static const struct of_device_id rcar_pcie_ep_of_match[] = { diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c index a20536d50c9c..4a6c9dfeab83 100644 --- a/drivers/pci/controller/pcie-rockchip-ep.c +++ b/drivers/pci/controller/pcie-rockchip-ep.c @@ -14,6 +14,7 @@ #include <linux/iopoll.h> #include <linux/kernel.h> #include <linux/irq.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/pci-epc.h> #include <linux/platform_device.h> @@ -704,6 +705,7 @@ static const struct pci_epc_ops rockchip_pcie_epc_ops = { .start = rockchip_pcie_ep_start, .stop = rockchip_pcie_ep_stop, .get_features = rockchip_pcie_ep_get_features, + .owner = THIS_MODULE, }; static int rockchip_pcie_ep_get_resources(struct rockchip_pcie *rockchip, -- 2.56.1.839.g22a8290db9-goog ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] PCI: endpoint: Set .owner = THIS_MODULE in remaining pci_epc_ops @ 2026-12-03 17:16 ` Ian Rogers 0 siblings, 0 replies; 6+ messages in thread From: Ian Rogers @ 2026-12-03 17:16 UTC (permalink / raw) To: Manivannan Sadhasivam, Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas Cc: Rob Herring, Nathan Chancellor, linux-pci, llvm, linux-kernel, Ian Rogers, Jingoo Han, Marek Vasut, Yoshihiro Shimoda, Geert Uytterhoeven, Magnus Damm, Shawn Lin, Heiko Stuebner, linux-renesas-soc, linux-rockchip, linux-arm-kernel pcie-designware-ep, pcie-rcar-ep, and pcie-rockchip-ep are currently bool Kconfig options (where THIS_MODULE is NULL), so omitting .owner in their struct pci_epc_ops definitions does not affect runtime module reference counting today. Initialize .owner = THIS_MODULE in all three for consistency across all struct pci_epc_ops definitions and to prepare for annotating pci_epc_ops::owner with Clang's require_explicit_initialization attribute. Signed-off-by: Ian Rogers <irogers@google.com> --- drivers/pci/controller/dwc/pcie-designware-ep.c | 2 ++ drivers/pci/controller/pcie-rcar-ep.c | 2 ++ drivers/pci/controller/pcie-rockchip-ep.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index e6060bb0bbbd..d5223597b5c9 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -8,6 +8,7 @@ #include <linux/align.h> #include <linux/bitfield.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/overflow.h> #include <linux/platform_device.h> @@ -949,6 +950,7 @@ static const struct pci_epc_ops epc_ops = { .get_features = dw_pcie_ep_get_features, .get_aux_resources_count = dw_pcie_ep_get_aux_resources_count, .get_aux_resources = dw_pcie_ep_get_aux_resources, + .owner = THIS_MODULE, }; /** diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c index e33c66caa1a6..b9df4699178c 100644 --- a/drivers/pci/controller/pcie-rcar-ep.c +++ b/drivers/pci/controller/pcie-rcar-ep.c @@ -7,6 +7,7 @@ */ #include <linux/delay.h> +#include <linux/module.h> #include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/pci.h> @@ -463,6 +464,7 @@ static const struct pci_epc_ops rcar_pcie_epc_ops = { .start = rcar_pcie_ep_start, .stop = rcar_pcie_ep_stop, .get_features = rcar_pcie_ep_get_features, + .owner = THIS_MODULE, }; static const struct of_device_id rcar_pcie_ep_of_match[] = { diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c index a20536d50c9c..4a6c9dfeab83 100644 --- a/drivers/pci/controller/pcie-rockchip-ep.c +++ b/drivers/pci/controller/pcie-rockchip-ep.c @@ -14,6 +14,7 @@ #include <linux/iopoll.h> #include <linux/kernel.h> #include <linux/irq.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/pci-epc.h> #include <linux/platform_device.h> @@ -704,6 +705,7 @@ static const struct pci_epc_ops rockchip_pcie_epc_ops = { .start = rockchip_pcie_ep_start, .stop = rockchip_pcie_ep_stop, .get_features = rockchip_pcie_ep_get_features, + .owner = THIS_MODULE, }; static int rockchip_pcie_ep_get_resources(struct rockchip_pcie *rockchip, -- 2.56.1.839.g22a8290db9-goog _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops 2026-12-03 17:16 [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops Ian Rogers 2026-12-03 17:16 ` [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops Ian Rogers 2026-12-03 17:16 ` Ian Rogers @ 2026-12-03 18:47 ` sashiko-bot 2 siblings, 0 replies; 6+ messages in thread From: sashiko-bot @ 2026-12-03 18:47 UTC (permalink / raw) To: Ian Rogers; +Cc: linux-pci Sashiko has finished reviewing this 2-patch series: - Patch 2: no issues found. - Patch 1 ("PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_..."): 1 potential issue (1 Low) A detailed review has been sent as a separate reply to patch 1. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203171642.440891-1-irogers@google.com ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-03 18:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-03 17:16 [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops Ian Rogers 2026-12-03 17:16 ` [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops Ian Rogers 2026-12-03 18:33 ` sashiko-bot 2026-12-03 17:16 ` [PATCH 2/2] PCI: endpoint: Set .owner = THIS_MODULE in remaining pci_epc_ops Ian Rogers 2026-12-03 17:16 ` Ian Rogers 2026-12-03 18:47 ` [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops 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.