drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl()

[ Upstream commit a40c7f61d1 ]

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: 7a7a933edd ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Rafael Mendonca 2022-09-16 17:47:51 -03:00 коммит произвёл Greg Kroah-Hartman
Родитель bdf54d4b00
Коммит b47a37ad4a
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -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;
}