Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2350379pxb; Mon, 20 Sep 2021 19:45:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm/nY9UpXR9WZWXWZTqRdQi5rC5+m9yDm8O9KOiq6+U3BZ0wJwA7d1euSEkgjP6/FS9lWu X-Received: by 2002:a50:d944:: with SMTP id u4mr20436783edj.327.1632192320375; Mon, 20 Sep 2021 19:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192320; cv=none; d=google.com; s=arc-20160816; b=lqk4ogce8on7NjnhCPDtRuQWzTyS22DW6l5BKFUPLIDDrvt0X+6n9PeIVQ7sT7faET CdpG8CbmBZFe90NXAVviIl/2Q075F5QbFFnX9E5owx8XDtnLxL9BgQuQnbQnhnDfyw59 hsDZO5ckrzdfUkcWsb0qCdu66NYwMAQPAAilSqW3uZjA3KT9AfHmosZHnezjmiwrEmcJ AJbCw0UjoJdXNX+fWvFmezXT3K9uv4cJRBOiIz+XRdSjXUUe5iOIGKS+xAw+24CZ4ier xchBa9iqCHTeuQMPl+RC2RAGH7g6IXnVZtXuvCFM3+Ti6cmOfoodzS9SgPHtNdiRhhMl SJsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pf3YIl6YIe9AaSK0xuGeg4Cy7jPClX2UPauzQ+R3TYw=; b=m/iNQnzMJ9scNEOIAGype17leP5yMpWT7gsxeinPkQJVofXvO/fYCjbqhoPaqhXunz hIMW7Kxjo8z9TSL/m3czZpLsCoQnC0njlrV5NN3nOv8YtYSx16P8LcC2EUqN5ON+evkG ZdevDFiYDw37JPujRCpALyK5WK8qyNAUNCuV6AqJoZZ5FXd5dJ+qYDRgsGj54W+yKvay SMDY5ZsllrKUFwHNL8Ub9KrYHkXQPFulgP7UFIajSfcTgnRB6SNR3UwA7EiCHe3gogvE Dtwz+ls6M+y32cR4DcSHh/z+2KsIGtze1NWAqFjC3ekBLgko8WtscNN3D0g19CVZf8Na J89A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Iy/KekHA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ha25si1555875ejb.302.2021.09.20.19.44.54; Mon, 20 Sep 2021 19:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Iy/KekHA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352319AbhITSXs (ORCPT + 99 others); Mon, 20 Sep 2021 14:23:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:40570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376865AbhITSQX (ORCPT ); Mon, 20 Sep 2021 14:16:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 20BFB63295; Mon, 20 Sep 2021 17:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158540; bh=Fkjka0ZUB9tSbs2BqjZxRBTvymRJ/aJl4Jvpnl9axfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iy/KekHAMlSbzaIcYXMi7+8B3BX38aQ4LSk0dW3Yk35v6Ixh6Z5n0KTRihJ1Rcehj bgxZzV22MSC2XdCILrsyL015+5TuxIqIfHxmqfNTEgTAT3OI1Rm1xvG7jiD0kow0Ca 8pGIalQBNEUoflFjw2yC0+MuWzUXvDnVAO0aXx6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Lucas Stach , Marek Vasut , Christian Gmeiner Subject: [PATCH 5.4 204/260] drm/etnaviv: fix MMU context leak on GPU reset Date: Mon, 20 Sep 2021 18:43:42 +0200 Message-Id: <20210920163938.040995639@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Stach commit f978a5302f5566480c58ffae64a16d34456801bd upstream. After a reset the GPU is no longer using the MMU context and may be restarted with a different context. While the mmu_state proeprly was cleared, the context wasn't unreferenced, leading to a memory leak. Cc: stable@vger.kernel.org # 5.4 Reported-by: Michael Walle Signed-off-by: Lucas Stach Tested-by: Michael Walle Tested-by: Marek Vasut Reviewed-by: Christian Gmeiner Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -547,6 +547,8 @@ static int etnaviv_hw_reset(struct etnav gpu->fe_running = false; gpu->exec_state = -1; + if (gpu->mmu_context) + etnaviv_iommu_context_put(gpu->mmu_context); gpu->mmu_context = NULL; return 0;