Skip to content

Commit

Permalink
drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl()
Browse files Browse the repository at this point in the history
If the copy of the description string from userspace fails, then the page
for the instance descriptor doesn't get freed before returning -EFAULT,
which leads to a memleak.

Fixes: 7a7a933 ("drm/vmwgfx: Introduce VMware mks-guest-stats")
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Reviewed-by: Martin Krastev <krastevm@vmware.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220916204751.720716-1-rafaelmendsr@gmail.com
Rafael Mendonca authored and Zack Rusin committed Sep 21, 2022
1 parent 110ae8a commit a40c7f6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
Original file line number Diff line number Diff line change
@@ -1076,6 +1076,7 @@ int vmw_mksstat_add_ioctl(struct drm_device *dev, void *data,

if (desc_len < 0) {
atomic_set(&dev_priv->mksstat_user_pids[slot], 0);
__free_page(page);
return -EFAULT;
}

0 comments on commit a40c7f6

Please sign in to comment.