drm/meson: Fix refcount leak in meson_encoder_hdmi_init
PATCH 1/1 drm/meson: Fix refcount leak in meson_encoder_hdmi_init
of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore.
Add missing put_device() in error path to avoid refcount leak.
--- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +3 -1
@@ -435,8 +435,10 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)cec_fill_conn_info_from_drm (&conn_info, meson_encoder_hdmi->connector); notifier =cec_notifier_conn_register (&pdev->dev,NULL , &conn_info); -if (!notifier) +if (!notifier) { +put_device (&pdev->dev);return -ENOMEM ; + } meson_encoder_hdmi->cec_notifier = notifier; }
Signature · 1 line
2.25.1
Quoted 17 lines · Miaoqian Lin
of_find_device_by_node()takes reference, we should useput_device()to release it when not need anymore.
Add missingput_device()in error path to avoid refcount leak.Fixes 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR")Signed-off-by Miaoqian Lin <[email protected]>--- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/meson/meson_encoder_hdmi.c +0
-0@@ -435,8 +435,10 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)cec_fill_conn_info_from_drm (&conn_info, meson_encoder_hdmi->connector);
drivers/gpu/drm/meson/meson_encoder_hdmi.c int meson_encoder_hdmi_init(struct meson_drm *priv) · line 444
Quoted 10 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +3
-1notifier =cec_notifier_conn_register (&pdev->dev,NULL , &conn_info); -if (!notifier) +if (!notifier) { +put_device (&pdev->dev);return -ENOMEM ; + } meson_encoder_hdmi->cec_notifier = notifier; }
Quoted 8 lines · Miaoqian Lin
of_find_device_by_node()takes reference, we should useput_device()to release it when not need anymore.
Add missingput_device()in error path to avoid refcount leak.Fixes 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR")Signed-off-by Miaoqian Lin <[email protected]>
Thanks for sending this patch!
Neil, while reviewing this I noticed that on module unload we're also not calling put_device().
This note doesn't affect this patch - but I am wondering if we need to put that put_device() during module unload on our TODO-list?
Best regards,
Martin
Hi,
Quoted 9 lines · Martin Blumenstingl
Quoted 8 lines · Miaoqian Lin
of_find_device_by_node()takes reference, we should useput_device()to release it when not need anymore.
Add missingput_device()in error path to avoid refcount leak.Fixes 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR")Signed-off-by Miaoqian Lin <[email protected]>
Quoted 9 lines
Reviewed-by Martin Blumenstingl <[email protected]>Thanks for sending this patch!
Neil, while reviewing this I noticed that on module unload we're also not calling
put_device().
This note doesn't affect this patch - but I am wondering if we need to put thatput_device()during module unload on our TODO-list?
Indeed, it should be fixed.
Neil
Quoted 3 lines
Best regards,
Martin
Neil Armstrong
AppliedHi,
Quoted 6 lines · Miaoqian Lin
of_find_device_by_node()takes reference, we should useput_device()to release it when not need anymore.
Add missingput_device()in error path to avoid refcount leak.
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)
[1/1] drm/meson: Fix refcount leak in meson_encoder_hdmi_init
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=7381076809586528e2a812a709e2758916318a99
Signature · 1 line
Neil