Skip to content

Commit df0e32b

Browse files
dinghaoliugregkh
authored andcommitted
drm/crc-debugfs: Fix memleak in crc_control_write
[ Upstream commit f7ec68b ] When verify_crc_source() fails, source needs to be freed. However, current code is returning directly and ends up leaking memory. Fixes: d5cc15a ("drm: crc: Introduce verify_crc_source callback") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [danvet: change Fixes: tag per Laurent's review] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20200819082228.26847-1-dinghao.liu@zju.edu.cn Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c6f45c5 commit df0e32b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/drm_debugfs_crc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,
144144
source[len - 1] = '\0';
145145

146146
ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt);
147-
if (ret)
147+
if (ret) {
148+
kfree(source);
148149
return ret;
150+
}
149151

150152
spin_lock_irq(&crc->lock);
151153

0 commit comments

Comments
 (0)