Commit f7ec68b3 authored by Dinghao Liu's avatar Dinghao Liu Committed by Daniel Vetter

drm/crc-debugfs: Fix memleak in crc_control_write

When verify_crc_source() fails, source needs to be freed.
However, current code is returning directly and ends up
leaking memory.

Fixes: d5cc15a0 ("drm: crc: Introduce verify_crc_source callback")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
[danvet: change Fixes: tag per Laurent's review]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200819082228.26847-1-dinghao.liu@zju.edu.cn
parent bfacb849
......@@ -144,8 +144,10 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,
source[len - 1] = '\0';
ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt);
if (ret)
if (ret) {
kfree(source);
return ret;
}
spin_lock_irq(&crc->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment