drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl()
Subsystems (3)
PATCH 1/1 drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl()
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 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats")
Signed-off-by Rafael Mendonca <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +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 ; }
Signature · 1 line
2.34.1
Thank you for the catch!
Reviewed-by Martin Krastev <[email protected]>
Regards,
Martin
Quoted 22 lines · Rafael Mendonca
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 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats")Signed-off-by Rafael Mendonca <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +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 ; }