* [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove
@ 2025-10-28 6:09 Miaoqian Lin
2025-10-28 14:00 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Miaoqian Lin @ 2025-10-28 6:09 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, benjamin.gaignard@linaro.org, Philippe Cornu,
dri-devel, linux-kernel
Cc: linmq006, stable
of_graph_get_remote_node() returns a device node
with its reference count incremented. The caller is responsible for
releasing this reference when the node is no longer needed.
Add of_node_put(remote) to fix the reference leak.
Found via static analysis.
Fixes: c70087e8f16f ("drm/drm_of: add drm_of_panel_bridge_remove function")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
include/drm/drm_of.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 7f0256dae3f1..5940b1cd542b 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -171,6 +171,7 @@ static inline int drm_of_panel_bridge_remove(const struct device_node *np,
return -ENODEV;
bridge = of_drm_find_bridge(remote);
+ of_node_put(remote);
drm_panel_bridge_remove(bridge);
return 0;
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove
2025-10-28 6:09 [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove Miaoqian Lin
@ 2025-10-28 14:00 ` kernel test robot
2025-10-28 14:22 ` kernel test robot
2025-10-28 14:32 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-10-28 14:00 UTC (permalink / raw)
To: Miaoqian Lin, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, benjamin.gaignard@linaro.org,
Philippe Cornu, dri-devel, linux-kernel
Cc: oe-kbuild-all, linmq006, stable
Hi Miaoqian,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.18-rc3 next-20251028]
[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/Miaoqian-Lin/drm-of-Fix-device-node-reference-leak-in-drm_of_panel_bridge_remove/20251028-141134
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20251028060918.65688-1-linmq006%40gmail.com
patch subject: [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove
config: mips-randconfig-r072-20251028 (https://download.01.org/0day-ci/archive/20251028/202510282123.AjUbRs11-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project e1ae12640102fd2b05bc567243580f90acb1135f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251028/202510282123.AjUbRs11-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/202510282123.AjUbRs11-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/gpu/drm/drm_bridge.c:37:
>> include/drm/drm_of.h:174:2: error: call to undeclared function 'of_node_put'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
174 | of_node_put(remote);
| ^
1 error generated.
--
In file included from drivers/gpu/drm/panel/panel-magnachip-d53e6ea8966.c:10:
>> include/drm/drm_of.h:174:2: error: call to undeclared function 'of_node_put'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
174 | of_node_put(remote);
| ^
In file included from drivers/gpu/drm/panel/panel-magnachip-d53e6ea8966.c:13:
In file included from include/linux/backlight.h:13:
In file included from include/linux/fb.h:5:
In file included from include/uapi/linux/fb.h:6:
In file included from include/linux/i2c.h:21:
In file included from include/linux/irqdomain.h:14:
>> include/linux/of.h:129:13: error: conflicting types for 'of_node_put'
129 | extern void of_node_put(struct device_node *node);
| ^
include/drm/drm_of.h:174:2: note: previous implicit declaration is here
174 | of_node_put(remote);
| ^
2 errors generated.
vim +/of_node_put +174 include/drm/drm_of.h
153
154 /*
155 * drm_of_panel_bridge_remove - remove panel bridge
156 * @np: device tree node containing panel bridge output ports
157 *
158 * Remove the panel bridge of a given DT node's port and endpoint number
159 *
160 * Returns zero if successful, or one of the standard error codes if it fails.
161 */
162 static inline int drm_of_panel_bridge_remove(const struct device_node *np,
163 int port, int endpoint)
164 {
165 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
166 struct drm_bridge *bridge;
167 struct device_node *remote;
168
169 remote = of_graph_get_remote_node(np, port, endpoint);
170 if (!remote)
171 return -ENODEV;
172
173 bridge = of_drm_find_bridge(remote);
> 174 of_node_put(remote);
175 drm_panel_bridge_remove(bridge);
176
177 return 0;
178 #else
179 return -EINVAL;
180 #endif
181 }
182
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove
2025-10-28 6:09 [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove Miaoqian Lin
2025-10-28 14:00 ` kernel test robot
@ 2025-10-28 14:22 ` kernel test robot
2025-10-28 14:32 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-10-28 14:22 UTC (permalink / raw)
To: Miaoqian Lin, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, benjamin.gaignard@linaro.org,
Philippe Cornu, dri-devel, linux-kernel
Cc: oe-kbuild-all, linmq006, stable
Hi Miaoqian,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.18-rc3 next-20251028]
[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/Miaoqian-Lin/drm-of-Fix-device-node-reference-leak-in-drm_of_panel_bridge_remove/20251028-141134
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20251028060918.65688-1-linmq006%40gmail.com
patch subject: [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove
config: x86_64-randconfig-161-20251028 (https://download.01.org/0day-ci/archive/20251028/202510282155.MdnvC7YI-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251028/202510282155.MdnvC7YI-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/202510282155.MdnvC7YI-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/tiny/arcpgu.c:23:
include/drm/drm_of.h: In function 'drm_of_panel_bridge_remove':
include/drm/drm_of.h:174:9: error: implicit declaration of function 'of_node_put' [-Wimplicit-function-declaration]
174 | of_node_put(remote);
| ^~~~~~~~~~~
In file included from include/linux/of_reserved_mem.h:6,
from drivers/gpu/drm/tiny/arcpgu.c:28:
include/linux/of.h: At top level:
>> include/linux/of.h:129:13: warning: conflicting types for 'of_node_put'; have 'void(struct device_node *)'
129 | extern void of_node_put(struct device_node *node);
| ^~~~~~~~~~~
include/drm/drm_of.h:174:9: note: previous implicit declaration of 'of_node_put' with type 'void(struct device_node *)'
174 | of_node_put(remote);
| ^~~~~~~~~~~
vim +129 include/linux/of.h
0829f6d1f69e4f Pantelis Antoniou 2013-12-13 126
0f22dd395fc473 Grant Likely 2012-02-15 127 #ifdef CONFIG_OF_DYNAMIC
0f22dd395fc473 Grant Likely 2012-02-15 128 extern struct device_node *of_node_get(struct device_node *node);
0f22dd395fc473 Grant Likely 2012-02-15 @129 extern void of_node_put(struct device_node *node);
0f22dd395fc473 Grant Likely 2012-02-15 130 #else /* CONFIG_OF_DYNAMIC */
3ecdd0515287af Rob Herring 2011-12-13 131 /* Dummy ref counting routines - to be implemented later */
3ecdd0515287af Rob Herring 2011-12-13 132 static inline struct device_node *of_node_get(struct device_node *node)
3ecdd0515287af Rob Herring 2011-12-13 133 {
3ecdd0515287af Rob Herring 2011-12-13 134 return node;
3ecdd0515287af Rob Herring 2011-12-13 135 }
0f22dd395fc473 Grant Likely 2012-02-15 136 static inline void of_node_put(struct device_node *node) { }
0f22dd395fc473 Grant Likely 2012-02-15 137 #endif /* !CONFIG_OF_DYNAMIC */
9448e55d032d99 Jonathan Cameron 2024-02-25 138 DEFINE_FREE(device_node, struct device_node *, if (_T) of_node_put(_T))
3ecdd0515287af Rob Herring 2011-12-13 139
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove
2025-10-28 6:09 [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove Miaoqian Lin
2025-10-28 14:00 ` kernel test robot
2025-10-28 14:22 ` kernel test robot
@ 2025-10-28 14:32 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-10-28 14:32 UTC (permalink / raw)
To: Miaoqian Lin, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, benjamin.gaignard@linaro.org,
Philippe Cornu, dri-devel, linux-kernel
Cc: oe-kbuild-all, linmq006, stable
Hi Miaoqian,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.18-rc3 next-20251028]
[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/Miaoqian-Lin/drm-of-Fix-device-node-reference-leak-in-drm_of_panel_bridge_remove/20251028-141134
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link: https://lore.kernel.org/r/20251028060918.65688-1-linmq006%40gmail.com
patch subject: [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove
config: parisc-randconfig-002-20251028 (https://download.01.org/0day-ci/archive/20251028/202510282250.QkCSotB2-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251028/202510282250.QkCSotB2-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/202510282250.QkCSotB2-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/bridge/ti-dlpc3433.c:12:
include/drm/drm_of.h: In function 'drm_of_panel_bridge_remove':
include/drm/drm_of.h:174:2: error: implicit declaration of function 'of_node_put'; did you mean 'fwnode_init'? [-Werror=implicit-function-declaration]
of_node_put(remote);
^~~~~~~~~~~
fwnode_init
In file included from include/linux/irqdomain.h:14,
from include/linux/i2c.h:21,
from drivers/gpu/drm/bridge/ti-dlpc3433.c:18:
include/linux/of.h: At top level:
>> include/linux/of.h:129:13: warning: conflicting types for 'of_node_put'
extern void of_node_put(struct device_node *node);
^~~~~~~~~~~
In file included from drivers/gpu/drm/bridge/ti-dlpc3433.c:12:
include/drm/drm_of.h:174:2: note: previous implicit declaration of 'of_node_put' was here
of_node_put(remote);
^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/of_node_put +129 include/linux/of.h
0829f6d1f69e4f Pantelis Antoniou 2013-12-13 126
0f22dd395fc473 Grant Likely 2012-02-15 127 #ifdef CONFIG_OF_DYNAMIC
0f22dd395fc473 Grant Likely 2012-02-15 128 extern struct device_node *of_node_get(struct device_node *node);
0f22dd395fc473 Grant Likely 2012-02-15 @129 extern void of_node_put(struct device_node *node);
0f22dd395fc473 Grant Likely 2012-02-15 130 #else /* CONFIG_OF_DYNAMIC */
3ecdd0515287af Rob Herring 2011-12-13 131 /* Dummy ref counting routines - to be implemented later */
3ecdd0515287af Rob Herring 2011-12-13 132 static inline struct device_node *of_node_get(struct device_node *node)
3ecdd0515287af Rob Herring 2011-12-13 133 {
3ecdd0515287af Rob Herring 2011-12-13 134 return node;
3ecdd0515287af Rob Herring 2011-12-13 135 }
0f22dd395fc473 Grant Likely 2012-02-15 136 static inline void of_node_put(struct device_node *node) { }
0f22dd395fc473 Grant Likely 2012-02-15 137 #endif /* !CONFIG_OF_DYNAMIC */
9448e55d032d99 Jonathan Cameron 2024-02-25 138 DEFINE_FREE(device_node, struct device_node *, if (_T) of_node_put(_T))
3ecdd0515287af Rob Herring 2011-12-13 139
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-28 14:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 6:09 [PATCH] drm/of: Fix device node reference leak in drm_of_panel_bridge_remove Miaoqian Lin
2025-10-28 14:00 ` kernel test robot
2025-10-28 14:22 ` kernel test robot
2025-10-28 14:32 ` 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;
as well as URLs for NNTP newsgroup(s).