From patchwork Wed Jun 14 23:18:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9787737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46054602CB for ; Thu, 15 Jun 2017 00:58:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B9B8284DC for ; Thu, 15 Jun 2017 00:58:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F114284ED; Thu, 15 Jun 2017 00:58:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D20A2284DC for ; Thu, 15 Jun 2017 00:58:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECDA96E65E; Thu, 15 Jun 2017 00:57:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 47D7C6E630 for ; Wed, 14 Jun 2017 23:18:57 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id o28so1618346lfk.1 for ; Wed, 14 Jun 2017 16:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=EZcvO43NlrWx7kn9V+hyshyJpVcb5pQlybuj1Oh1gPk=; b=mBIqBYUMdjN62AmdqM14pytYavLFQNXSLqtJLL299a9EOK9+9rn7muP/fp0anMuAU+ eUOJKq5yIRgH8DV+gnxroUef8zEbwYPBZd6F8xg0fjWG2Q1je02InKMdwEBinI7Of7LK 1zz1HbxyXEyRdzngfiJWaLanjUNhu47jk3V+LMfnbG3vQl62fmF5+639q1AlWpLZkC/C 0gZ/NIK9kB51DEcrZeP9dW5taDFxyrH5KLdeM7nMl7ChpLZlkvfKRKNJ6NWSuvSc0/yM DwvnQpdwMrvWS5JQrhCFZhIeLFVE/LhZctxmLWg8SrYUJV2xRVTFZjSptN4djz7Pb2H/ uL9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=EZcvO43NlrWx7kn9V+hyshyJpVcb5pQlybuj1Oh1gPk=; b=oC3MgWDN/h1Nv765KR3oCCipkD0uKZr4oBM1rFtIQ/HRPiBg30SgJ9yfnZ/Q8YRdJR +5/RH9RB+xg1IBcUG51fo2Hhth62jy1PbRT6gwEqF4JN61dzzpH8e/0dGWb/RX/i0jOp IaSnGjEbhxKuwgedApXd4DpNvmbSqRDDVVHlHr2u0+26R4MU8RNjwjBD6Dke9rbuRSJB TK33pDyI9MSqo44vAjwkmwrzmASQaToQACfvxllMpblucBFK7Z3+1lsN7F6yFMGRE5tf EPbrbn4vjqIjepEtNvRbqFTAgG2yPs73OBsw0B+MyzfEJCQZtxKFPFsLMTuuP8w69JYa ECBQ== X-Gm-Message-State: AKS2vOx+NxaAHwGDGvW7e6bsCYRycRmemmq2hBTiGoGhQS9eY9LfNhM8 YTrtxfFsDcCg4Q== X-Received: by 10.25.201.2 with SMTP id z2mr761640lff.72.1497482335771; Wed, 14 Jun 2017 16:18:55 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id i24sm290165ljb.63.2017.06.14.16.18.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 16:18:54 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v3 01/20] drm/tegra: Fix lockup on a use of staging API Date: Thu, 15 Jun 2017 02:18:24 +0300 Message-Id: <7b70a506a9d2355ea6ff19a8c4f4d726b67719b3.1497480754.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Thu, 15 Jun 2017 00:57:20 +0000 Cc: linux-tegra@vger.kernel.org, DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit bdd2f9cd ("Don't leak kernel pointer to userspace") added a mutex around staging IOCTL's, some of those mutexes are taken twice. Fixes: bdd2f9cd10eb ("drm/tegra: Don't leak kernel pointer to userspace") Signed-off-by: Dmitry Osipenko Reviewed-by: Mikko Perttunen Reviewed-by: Erik Faye-Lund --- drivers/gpu/drm/tegra/drm.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 51c48a8e00ec..b49d32a89f40 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -451,18 +451,6 @@ int tegra_drm_submit(struct tegra_drm_context *context, #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, struct drm_file *file) { @@ -606,7 +594,7 @@ static int tegra_close_channel(struct drm_device *drm, void *data, mutex_lock(&fpriv->lock); - context = tegra_drm_file_get_context(fpriv, args->context); + context = idr_find(&fpriv->contexts, args->context); if (!context) { err = -EINVAL; goto unlock; @@ -631,7 +619,7 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, mutex_lock(&fpriv->lock); - context = tegra_drm_file_get_context(fpriv, args->context); + context = idr_find(&fpriv->contexts, args->context); if (!context) { err = -ENODEV; goto unlock; @@ -660,7 +648,7 @@ static int tegra_submit(struct drm_device *drm, void *data, mutex_lock(&fpriv->lock); - context = tegra_drm_file_get_context(fpriv, args->context); + context = idr_find(&fpriv->contexts, args->context); if (!context) { err = -ENODEV; goto unlock; @@ -685,7 +673,7 @@ static int tegra_get_syncpt_base(struct drm_device *drm, void *data, mutex_lock(&fpriv->lock); - context = tegra_drm_file_get_context(fpriv, args->context); + context = idr_find(&fpriv->contexts, args->context); if (!context) { err = -ENODEV; goto unlock;