[PATCH] drm/mipi-dsi: fix possible memory leak in mipi_dsi_device_register_full()
Thierry Reding
treding at nvidia.com
Tue Oct 18 10:22:11 UTC 2022
On Tue, Oct 18, 2022 at 04:25:45PM +0800, Yang Yingliang wrote:
> If mipi_dsi_device_add() fails, the refcount of device is not 0, the name
> allocated in dev_set_name() is leaked. Fix this by calling put_device(),
> so that it will be freed in callback function kobject_cleanup().
>
> Fixes: 068a00233969 ("drm: Add MIPI DSI bus support")
> Signed-off-by: Yang Yingliang <yangyingliang at huawei.com>
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Good catch! The device_initialize() function (which is called via
mipi_dsi_device_alloc() earlier in mipi_dsi_device_register_full()) has
a comment that put_device() should be used after it was called.
Reviewed-by: Thierry Reding <treding at nvidia.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20221018/ee1798d6/attachment.sig>
More information about the dri-devel
mailing list