Skip to content

Commit

Permalink
drm/amd/display: Fix possible memleak in dp_trigger_hotplug()
Browse files Browse the repository at this point in the history
If parse_write_buffer_into_params() fails, we should free
wr_buf before return.

Fixes: 6f77b2a ("drm/amd/display: Add connector HPD trigger debugfs entry")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
YueHaibing authored and Alex Deucher committed Sep 15, 2020
1 parent d56b83f commit d75fa67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,10 @@ static ssize_t dp_trigger_hotplug(struct file *f, const char __user *buf,
if (parse_write_buffer_into_params(wr_buf, size,
(long *)param, buf,
max_param_num,
&param_nums))
&param_nums)) {
kfree(wr_buf);
return -EINVAL;
}

if (param_nums <= 0) {
DRM_DEBUG_DRIVER("user data not be read\n");
Expand Down

0 comments on commit d75fa67

Please sign in to comment.