]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/amd/display: Fix possible memleak in dp_trigger_hotplug()
authorYueHaibing <yuehaibing@huawei.com>
Thu, 10 Sep 2020 03:26:36 +0000 (11:26 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Sep 2020 21:52:43 +0000 (17:52 -0400)
If parse_write_buffer_into_params() fails, we should free
wr_buf before return.

Fixes: 6f77b2ac6280 ("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>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

index 9be2f291382df9b55f7ce4df19d3cbcb7cd929ec..47cc39ad47f9bab065a5058b2c1c3f0024a1b7f4 100644 (file)
@@ -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");