Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm: fix memleak on release

If a process is interrupted while accessing the "gpu" debugfs file and
the drm device struct_mutex is contended, release() could return early
and fail to free related resources.

Note that the return value from release() is ignored.

Fixes: 4f776f4511c7 ("drm/msm/gpu: Convert the GPU show function to use the GPU state")
Cc: stable <stable@vger.kernel.org> # 4.18
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191010131333.23635-2-johan@kernel.org

authored by

Johan Hovold and committed by
Sean Paul
a64fc11b 3ca3a9ea

+1 -5
+1 -5
drivers/gpu/drm/msm/msm_debugfs.c
··· 47 47 struct msm_gpu_show_priv *show_priv = m->private; 48 48 struct msm_drm_private *priv = show_priv->dev->dev_private; 49 49 struct msm_gpu *gpu = priv->gpu; 50 - int ret; 51 50 52 - ret = mutex_lock_interruptible(&show_priv->dev->struct_mutex); 53 - if (ret) 54 - return ret; 55 - 51 + mutex_lock(&show_priv->dev->struct_mutex); 56 52 gpu->funcs->gpu_state_put(show_priv->state); 57 53 mutex_unlock(&show_priv->dev->struct_mutex); 58 54