lkml.org 
[lkml]   [2022]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 236/530] drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl()
    Date
    From: Rafael Mendonca <rafaelmendsr@gmail.com>

    [ Upstream commit a40c7f61d12fbd1e785e59140b9efd57127c0c33 ]

    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 <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>
    ---
    drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
    index e50fb82a3030..47eb3a50dd08 100644
    --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
    +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
    @@ -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;
    }

    --
    2.35.1


    \
     
     \ /
      Last update: 2022-10-24 22:46    [W:3.105 / U:0.540 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site