* [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind()
@ 2026-05-09 9:18 Wentao Liang
2026-05-12 21:49 ` kernel test robot
2026-05-13 2:52 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-05-09 9:18 UTC (permalink / raw)
To: linux, airlied, simona; +Cc: dri-devel, linux-kernel, Wentao Liang, stable
In armada_lcd_bind(), of_get_child_by_name() obtains a reference to
the "port" device_node which is passed to armada_drm_crtc_create().
On success, the reference is transferred to the crtc structure and
released later. However, if armada_drm_crtc_create() fails, the
function returns directly without releasing the port node, causing a
reference leak.
Fix by adding of_node_put(port) in the error path.
Fixes: 9611cb93fa65 ("drm/armada: register crtc with port")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/gpu/drm/armada/armada_crtc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 0900e4466ffb..dfca664847b6 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -1035,7 +1035,10 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data)
}
}
- return armada_drm_crtc_create(drm, dev, res, irq, variant, port);
+ ret = armada_drm_crtc_create(drm, dev, res, irq, variant, port);
+ if (ret)
+ of_node_put(port);
+ return ret;
}
static void
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind()
2026-05-09 9:18 [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind() Wentao Liang
@ 2026-05-12 21:49 ` kernel test robot
2026-05-13 2:52 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-05-12 21:49 UTC (permalink / raw)
To: Wentao Liang, linux, airlied, simona
Cc: oe-kbuild-all, dri-devel, linux-kernel, Wentao Liang, stable
Hi Wentao,
kernel test robot noticed the following build warnings:
[auto build test WARNING on daeinki-drm-exynos/exynos-drm-next]
[also build test WARNING on drm/drm-next drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master rmk-arm/drm-armada-devel v7.1-rc3 next-20260508]
[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/drm-armada-fix-device_node-reference-leak-in-armada_lcd_bind/20260512-194755
base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
patch link: https://lore.kernel.org/r/20260509091821.963513-1-vulab%40iscas.ac.cn
patch subject: [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind()
config: arm-randconfig-002-20260513 (https://download.01.org/0day-ci/archive/20260513/202605130528.fPiFL3HJ-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260513/202605130528.fPiFL3HJ-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/202605130528.fPiFL3HJ-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/gpu/drm/armada/armada_crtc.c: In function 'armada_lcd_bind':
drivers/gpu/drm/armada/armada_crtc.c:1039:9: error: 'ret' undeclared (first use in this function); did you mean 'res'?
1039 | ret = armada_drm_crtc_create(drm, dev, res, irq, variant, port);
| ^~~
| res
drivers/gpu/drm/armada/armada_crtc.c:1039:9: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/armada/armada_crtc.c:1043:1: warning: control reaches end of non-void function [-Wreturn-type]
1043 | }
| ^
vim +1043 drivers/gpu/drm/armada/armada_crtc.c
d8c96083cf5e4a Russell King 2014-04-22 1007
d8c96083cf5e4a Russell King 2014-04-22 1008 static int
d8c96083cf5e4a Russell King 2014-04-22 1009 armada_lcd_bind(struct device *dev, struct device *master, void *data)
d8c96083cf5e4a Russell King 2014-04-22 1010 {
d8c96083cf5e4a Russell King 2014-04-22 1011 struct platform_device *pdev = to_platform_device(dev);
d8c96083cf5e4a Russell King 2014-04-22 1012 struct drm_device *drm = data;
d8c96083cf5e4a Russell King 2014-04-22 1013 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
d8c96083cf5e4a Russell King 2014-04-22 1014 int irq = platform_get_irq(pdev, 0);
d8c96083cf5e4a Russell King 2014-04-22 1015 const struct armada_variant *variant;
9611cb93fa65dd Russell King 2014-06-15 1016 struct device_node *port = NULL;
e1704914867872 Rob Herring 2023-10-20 1017 struct device_node *np, *parent = dev->of_node;
d8c96083cf5e4a Russell King 2014-04-22 1018
d8c96083cf5e4a Russell King 2014-04-22 1019 if (irq < 0)
d8c96083cf5e4a Russell King 2014-04-22 1020 return irq;
d8c96083cf5e4a Russell King 2014-04-22 1021
d8c96083cf5e4a Russell King 2014-04-22 1022
e1704914867872 Rob Herring 2023-10-20 1023 variant = device_get_match_data(dev);
e1704914867872 Rob Herring 2023-10-20 1024 if (!variant)
d8c96083cf5e4a Russell King 2014-04-22 1025 return -ENXIO;
d8c96083cf5e4a Russell King 2014-04-22 1026
e1704914867872 Rob Herring 2023-10-20 1027 if (parent) {
9611cb93fa65dd Russell King 2014-06-15 1028 np = of_get_child_by_name(parent, "ports");
9611cb93fa65dd Russell King 2014-06-15 1029 if (np)
9611cb93fa65dd Russell King 2014-06-15 1030 parent = np;
9611cb93fa65dd Russell King 2014-06-15 1031 port = of_get_child_by_name(parent, "port");
9611cb93fa65dd Russell King 2014-06-15 1032 of_node_put(np);
9611cb93fa65dd Russell King 2014-06-15 1033 if (!port) {
4bf99144d2b407 Rob Herring 2017-07-18 1034 dev_err(dev, "no port node found in %pOF\n", parent);
9611cb93fa65dd Russell King 2014-06-15 1035 return -ENXIO;
9611cb93fa65dd Russell King 2014-06-15 1036 }
d8c96083cf5e4a Russell King 2014-04-22 1037 }
d8c96083cf5e4a Russell King 2014-04-22 1038
2627b8898b0e61 Wentao Liang 2026-05-09 1039 ret = armada_drm_crtc_create(drm, dev, res, irq, variant, port);
2627b8898b0e61 Wentao Liang 2026-05-09 1040 if (ret)
2627b8898b0e61 Wentao Liang 2026-05-09 1041 of_node_put(port);
2627b8898b0e61 Wentao Liang 2026-05-09 1042 return ret;
d8c96083cf5e4a Russell King 2014-04-22 @1043 }
d8c96083cf5e4a Russell King 2014-04-22 1044
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind()
2026-05-09 9:18 [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind() Wentao Liang
2026-05-12 21:49 ` kernel test robot
@ 2026-05-13 2:52 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-05-13 2:52 UTC (permalink / raw)
To: Wentao Liang, linux, airlied, simona
Cc: llvm, oe-kbuild-all, dri-devel, linux-kernel, Wentao Liang,
stable
Hi Wentao,
kernel test robot noticed the following build errors:
[auto build test ERROR on daeinki-drm-exynos/exynos-drm-next]
[also build test ERROR on drm/drm-next drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master rmk-arm/drm-armada-devel v7.1-rc3 next-20260508]
[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/drm-armada-fix-device_node-reference-leak-in-armada_lcd_bind/20260512-194755
base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
patch link: https://lore.kernel.org/r/20260509091821.963513-1-vulab%40iscas.ac.cn
patch subject: [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind()
config: arm-randconfig-003-20260512 (https://download.01.org/0day-ci/archive/20260513/202605131053.Tvq0phKC-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260513/202605131053.Tvq0phKC-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/202605131053.Tvq0phKC-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/armada/armada_crtc.c:1039:2: error: use of undeclared identifier 'ret'; did you mean 'res'?
1039 | ret = armada_drm_crtc_create(drm, dev, res, irq, variant, port);
| ^~~
| res
drivers/gpu/drm/armada/armada_crtc.c:1013:19: note: 'res' declared here
1013 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
| ^
>> drivers/gpu/drm/armada/armada_crtc.c:1039:6: error: incompatible integer to pointer conversion assigning to 'struct resource *' from 'int' [-Wint-conversion]
1039 | ret = armada_drm_crtc_create(drm, dev, res, irq, variant, port);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/armada/armada_crtc.c:1040:6: error: use of undeclared identifier 'ret'; did you mean 'res'?
1040 | if (ret)
| ^~~
| res
drivers/gpu/drm/armada/armada_crtc.c:1013:19: note: 'res' declared here
1013 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
| ^
drivers/gpu/drm/armada/armada_crtc.c:1042:9: error: use of undeclared identifier 'ret'; did you mean 'res'?
1042 | return ret;
| ^~~
| res
drivers/gpu/drm/armada/armada_crtc.c:1013:19: note: 'res' declared here
1013 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
| ^
>> drivers/gpu/drm/armada/armada_crtc.c:1042:9: error: incompatible pointer to integer conversion returning 'struct resource *' from a function with result type 'int' [-Wint-conversion]
1042 | return ret;
| ^~~
5 errors generated.
vim +1039 drivers/gpu/drm/armada/armada_crtc.c
1007
1008 static int
1009 armada_lcd_bind(struct device *dev, struct device *master, void *data)
1010 {
1011 struct platform_device *pdev = to_platform_device(dev);
1012 struct drm_device *drm = data;
1013 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1014 int irq = platform_get_irq(pdev, 0);
1015 const struct armada_variant *variant;
1016 struct device_node *port = NULL;
1017 struct device_node *np, *parent = dev->of_node;
1018
1019 if (irq < 0)
1020 return irq;
1021
1022
1023 variant = device_get_match_data(dev);
1024 if (!variant)
1025 return -ENXIO;
1026
1027 if (parent) {
1028 np = of_get_child_by_name(parent, "ports");
1029 if (np)
1030 parent = np;
1031 port = of_get_child_by_name(parent, "port");
1032 of_node_put(np);
1033 if (!port) {
1034 dev_err(dev, "no port node found in %pOF\n", parent);
1035 return -ENXIO;
1036 }
1037 }
1038
> 1039 ret = armada_drm_crtc_create(drm, dev, res, irq, variant, port);
1040 if (ret)
1041 of_node_put(port);
> 1042 return ret;
1043 }
1044
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-13 2:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09 9:18 [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind() Wentao Liang
2026-05-12 21:49 ` kernel test robot
2026-05-13 2:52 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox