Commit 1066a895 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Thierry Reding

drm/tegra: Fix lockup on a use of staging API

Commit bdd2f9cd ("Don't leak kernel pointer to userspace") added a
mutex around staging IOCTL's, some of those mutexes are taken twice.

Fixes: bdd2f9cd ("drm/tegra: Don't leak kernel pointer to userspace")
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Reviewed-by: default avatarMikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: default avatarErik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/7b70a506a9d2355ea6ff19a8c4f4d726b67719b3.1497480754.git.digetx@gmail.com
parent 59e04bc2
...@@ -451,18 +451,6 @@ int tegra_drm_submit(struct tegra_drm_context *context, ...@@ -451,18 +451,6 @@ int tegra_drm_submit(struct tegra_drm_context *context,
#ifdef CONFIG_DRM_TEGRA_STAGING #ifdef CONFIG_DRM_TEGRA_STAGING
static struct tegra_drm_context *
tegra_drm_file_get_context(struct tegra_drm_file *file, u32 id)
{
struct tegra_drm_context *context;
mutex_lock(&file->lock);
context = idr_find(&file->contexts, id);
mutex_unlock(&file->lock);
return context;
}
static int tegra_gem_create(struct drm_device *drm, void *data, static int tegra_gem_create(struct drm_device *drm, void *data,
struct drm_file *file) struct drm_file *file)
{ {
...@@ -606,7 +594,7 @@ static int tegra_close_channel(struct drm_device *drm, void *data, ...@@ -606,7 +594,7 @@ static int tegra_close_channel(struct drm_device *drm, void *data,
mutex_lock(&fpriv->lock); mutex_lock(&fpriv->lock);
context = tegra_drm_file_get_context(fpriv, args->context); context = idr_find(&fpriv->contexts, args->context);
if (!context) { if (!context) {
err = -EINVAL; err = -EINVAL;
goto unlock; goto unlock;
...@@ -631,7 +619,7 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, ...@@ -631,7 +619,7 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data,
mutex_lock(&fpriv->lock); mutex_lock(&fpriv->lock);
context = tegra_drm_file_get_context(fpriv, args->context); context = idr_find(&fpriv->contexts, args->context);
if (!context) { if (!context) {
err = -ENODEV; err = -ENODEV;
goto unlock; goto unlock;
...@@ -660,7 +648,7 @@ static int tegra_submit(struct drm_device *drm, void *data, ...@@ -660,7 +648,7 @@ static int tegra_submit(struct drm_device *drm, void *data,
mutex_lock(&fpriv->lock); mutex_lock(&fpriv->lock);
context = tegra_drm_file_get_context(fpriv, args->context); context = idr_find(&fpriv->contexts, args->context);
if (!context) { if (!context) {
err = -ENODEV; err = -ENODEV;
goto unlock; goto unlock;
...@@ -685,7 +673,7 @@ static int tegra_get_syncpt_base(struct drm_device *drm, void *data, ...@@ -685,7 +673,7 @@ static int tegra_get_syncpt_base(struct drm_device *drm, void *data,
mutex_lock(&fpriv->lock); mutex_lock(&fpriv->lock);
context = tegra_drm_file_get_context(fpriv, args->context); context = idr_find(&fpriv->contexts, args->context);
if (!context) { if (!context) {
err = -ENODEV; err = -ENODEV;
goto unlock; goto unlock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment