Re: [PATCH] fix: drm/hisilicon: kirin_drm_crtc_init: premature of_node_put leaves crtc->port as dangling pointer
From: WenTao Liang
Date: Sat Jun 27 2026 - 23:56:08 EST
> 2026年6月26日 21:19,WenTao Liang <vulab@xxxxxxxxxxx> 写道:
>
> of_get_child_by_name acquires a reference on the port node, but
> of_node_put is called before crtc->port is assigned. This releases the
> reference while crtc->port still holds the pointer for later use by
> drm_of_find_possible_crtcs. Fix by moving of_node_put after crtc->port
> assignment.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 89a565dba1a0 ("drm: kirin: Move ade drm init to kirin drm drv")
> Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
> ---
> drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 8a11c2df5b88..cc453b29b22c 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -53,8 +53,8 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> DRM_ERROR("no port node found in %pOF\n", dev->dev->of_node);
> return -EINVAL;
> }
> - of_node_put(port);
> crtc->port = port;
> + of_node_put(port);
>
> ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
> driver_data->crtc_funcs, NULL);
> --
> 2.39.5 (Apple Git-154)
Please ignore this patch. I will resend a proper version after
learning the kernel submission process.
Apologies for the noise.
Best regards,
WenTao Liang