Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp771681ybl; Wed, 11 Dec 2019 07:17:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyq8e/vKk4qtAYcPk/W/CRz2jBXpp7VB0exj0ueDIadUwVzLiEmp7VEsPRm5qzrziPYmkzL X-Received: by 2002:aca:aacf:: with SMTP id t198mr3226480oie.135.1576077437476; Wed, 11 Dec 2019 07:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077437; cv=none; d=google.com; s=arc-20160816; b=KS1FwVLGfP4Aijl90PALSHd6N0X+3CtW3k32x5lfui/GhOEiEbJ6PbJNy6K2aWK+ZF YfWP+1x7652R3+6FAk7TJ1Vbcp5eAXRg+sgZqrS12636TCdpDXaQUE6pw6dzNpIfqeH3 wBZv2ZWaphRY+P742IKP+lCpCLcIYqjA7MC+r7fqr/vyHibXskCKgN8tKypsSAMfZrvD mKogUfz7PDxfqbB7pYnrx70TqIKRY4v4Fisl8Zc0hznM6XqFLtQUZ7uFGtvV8/E71rv8 pO3rEt5otHthMMG8ssPAIcifdgD0p1NL6ZrVHcyQuv4LGWTowQmDhtNSBfZYyk5MDCum vJdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HHp+N0+/t9vS3e8Ty77TnOCwITzyk3GRNhx5V8xkMWg=; b=JNBypEoQ1EQJnMTuSeKtqzLM5cHw4fnbW+6uscyVmJAncK1MshfRYRbxaS5QUIrNzS p3xB1gW4dRG/sd6YKm9tRpi13CwLUyrW1oB8qzuJOReSs+B7cU4tBEZUsz3af3ZA76t9 1SCdo/MxLowlggHgWNNGoHGSyZn1+lYPHbSKQ9yBxjeesfTSvvz52gWfBxan9xZr5neU Q2hsB0RNRjxSTv5BvW+maeEWS+iBN5JH1oeDEfX5jkePyXrAwUgVpOp0FvSOvBFxLh3a B/rPC+KKzami2PS3p//9eePIg3NDMX1BEVhrfcXmxW7Y7HFEKhbYoCdG5IWIZxd0m7HL PCpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IOv2jt9h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j18si1251465otq.275.2019.12.11.07.17.04; Wed, 11 Dec 2019 07:17:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IOv2jt9h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731723AbfLKPPL (ORCPT + 99 others); Wed, 11 Dec 2019 10:15:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:38868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731583AbfLKPOI (ORCPT ); Wed, 11 Dec 2019 10:14:08 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D5742467E; Wed, 11 Dec 2019 15:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077247; bh=ceI3moN7maTEnOKuASmRNwsQp0So9f3dodO10LGkVB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOv2jt9hQpSNroyp817BenK2v4sEL3dPPQ9R/hgrD5/GUV822jRMnFfLhTE4YK21v 9OHj/2QF5ZiJ7jT7GdQ9Vc5/sn7rZji4r2yUBhkVnbQlU/osFMRlQRrE5n9HfSMcEK 4BkU2Vm/o8br8ZD6IwZR1f7/1zD51qmFRWmGcjpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jordan Crouse , Rob Clark , Johan Hovold , Sean Paul Subject: [PATCH 5.3 072/105] drm/msm: fix memleak on release Date: Wed, 11 Dec 2019 16:06:01 +0100 Message-Id: <20191211150251.957574699@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit a64fc11b9a520c55ca34d82e5ca32274f49b6b15 upstream. 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 # 4.18 Cc: Jordan Crouse Cc: Rob Clark Reviewed-by: Rob Clark Signed-off-by: Johan Hovold Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20191010131333.23635-2-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/msm/msm_debugfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -42,12 +42,8 @@ static int msm_gpu_release(struct inode struct msm_gpu_show_priv *show_priv = m->private; struct msm_drm_private *priv = show_priv->dev->dev_private; struct msm_gpu *gpu = priv->gpu; - int ret; - - ret = mutex_lock_interruptible(&show_priv->dev->struct_mutex); - if (ret) - return ret; + mutex_lock(&show_priv->dev->struct_mutex); gpu->funcs->gpu_state_put(show_priv->state); mutex_unlock(&show_priv->dev->struct_mutex);