Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2230858ybi; Thu, 20 Jun 2019 11:15:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD/8rMpZbqabIA+cj3HvaDvA0VyuL31OWRwcPJx5OjARXb8ukzPhADFsMeqg1apC+0aXqB X-Received: by 2002:a62:3c3:: with SMTP id 186mr14436674pfd.21.1561054549720; Thu, 20 Jun 2019 11:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054549; cv=none; d=google.com; s=arc-20160816; b=pNAScxvZR/cGU5HcsKXuJ5BLmuVo+YOBkskpSImYgBmwQ7n4lGDnZMje5AyKh55Qtg 0H2zajPCvfbXO3FziimuEGHwPwDzyQ/JFCCABFF+NXPY8m2qnebnGLxnQGJFVBoSqQat gdfvuwYOYoI1UsuunddiiDHlzE7YoA8a0MrxgPYk0poypA2Bxo+auGukkXa1uehSv627 HbFo5gtfzQBrkzT9G33aeJ47WSaPYEZKwMyucYRrW55zaX9urojYksJd3+5Rmmh0bpy7 yKuZxFt0ehnb4Ie2sihQEbiGaIIw6KFCya759R1CP1iXXJGLIgGRTCS587TA+quMRQnd 3J3Q== 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=7Kx8Mi6zk+DMudwP5Xbypiw7WysAUYeCHA5pr6RMH6c=; b=N7SKv8v+l5iaP9QS73C01zwGZXDqP6qll7pgqC3RqidRN4yg+eeuMEurqnwJkEe0MM PRMsnkRv2LG7AcQmbOXk0CpzgzkbsYjftG1O+C1q7WUhjM2X2uDyfH092W8s/ZBNsm27 cbyyHNM1JhIPMTqqiO3BpOEDcGjJNQEklmUZQgg2JdvYJE9mkQMdOZfCT6h3f/JPwsn0 +cWb2mNlIJj7im8UEG1uXvudhaq8dzAhX7IT/LX2jdhWIdG3YWRWsDLPnXbLhs6WgHpL uFc5spkEOs5gh6gPlGoHYAXxvS+mXbEnh7jIvRdCvLR6FCO3O62ZQnL0WraiATnL3xun PJJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H0RJlQLq; 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 g12si374428pjs.35.2019.06.20.11.15.34; Thu, 20 Jun 2019 11:15:49 -0700 (PDT) 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=H0RJlQLq; 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 S1729610AbfFTSPa (ORCPT + 99 others); Thu, 20 Jun 2019 14:15:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:44270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729395AbfFTSP2 (ORCPT ); Thu, 20 Jun 2019 14:15:28 -0400 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 4321C2084E; Thu, 20 Jun 2019 18:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054527; bh=BP8IddWGjCAgLv+nYP0K19A5yvQ9scesSZhse41AXdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0RJlQLqWhyH9+4TkYaqLwx0troKbrsq+F7xxAKzXSAtpugFfstde0TYzjRENBZbq Mw8tEqKR0V72i8O8phvlMz5EaM6htS4URl+Uo5P7uWCeohWBugBBgd/q47Ob/rODFZ 8Mw43CWc1tg8NNW24TaHg0CbmkMoogzrhjDyx6iY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Jander , Lucas Stach , Philipp Zabel , Sasha Levin Subject: [PATCH 5.1 60/98] drm/etnaviv: lock MMU while dumping core Date: Thu, 20 Jun 2019 19:57:27 +0200 Message-Id: <20190620174352.099265172@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@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 [ Upstream commit 1396500d673bd027683a0609ff84dca7eb6ea2e7 ] The devcoredump needs to operate on a stable state of the MMU while it is writing the MMU state to the coredump. The missing lock allowed both the userspace submit, as well as the GPU job finish paths to mutate the MMU state while a coredump is under way. Fixes: a8c21a5451d8 (drm/etnaviv: add initial etnaviv DRM driver) Reported-by: David Jander Signed-off-by: Lucas Stach Tested-by: David Jander Reviewed-by: Philipp Zabel Signed-off-by: Sasha Levin --- drivers/gpu/drm/etnaviv/etnaviv_dump.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c index 33854c94cb85..515515ef24f9 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c @@ -125,6 +125,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu) return; etnaviv_dump_core = false; + mutex_lock(&gpu->mmu->lock); + mmu_size = etnaviv_iommu_dump_size(gpu->mmu); /* We always dump registers, mmu, ring and end marker */ @@ -167,6 +169,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu) iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, PAGE_KERNEL); if (!iter.start) { + mutex_unlock(&gpu->mmu->lock); dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); return; } @@ -234,6 +237,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu) obj->base.size); } + mutex_unlock(&gpu->mmu->lock); + etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data); dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL); -- 2.20.1