Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7151564ybi; Mon, 8 Jul 2019 15:41:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXQzbcWXKQQov6jC6Fb+N0Z5DVG1Aoa0hawXUnnnwdqdXnGIbKA6Y5MTO8QJl2vpOdQrqR X-Received: by 2002:a17:90a:23a4:: with SMTP id g33mr29383649pje.115.1562625669652; Mon, 08 Jul 2019 15:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625669; cv=none; d=google.com; s=arc-20160816; b=dHxhEYNZBoqbOgnoHyn9UzvrZKcy7FszKshWo+o63jJtgsejS5RxWx40LBS6V83lOp zd0WFkw7ljagYhw9tZaJ131J9ujE7fdfQPchSpC8LsBNVfqFt4T1TVXJD6VMx8rbLvsn CaE9Z+aqODSTwG+kQhLLSM+7yzlC4hE1xIUDb1gkXouLfWIyyXF+C3Sl7EH9Uw8VJowS EkWAec3hK4nwIaU2++a3N5jVbk62AJ+JMM6+UeWNK/kkOX6UMayB0IVdt2FdVvmyGDof vXDQth0XlvRCRD8Fq0lIy8LphWV92awdFxvOqgdMvMLVUKvU45PzAn+k/tHhwUvM6s6N /O2w== 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=eua7CAv8L7Qe7L2NhUzBQyJI5FgUl9T7z46aqiFgvjs=; b=TpFAwiUAOmUPgkSElclM4EgTIUddxXta6xKA8dO6rkBWwzPMlIBShA7wR7Ud0/AdKQ laM0MqDpx0WkE47ztvste5smVOQkGFSsYo7jMmRH4i7bjSilrMUGqFbgnzxY3i6uxJSr rKNnac5eNshLD1LGJti78Tn+qe0dfV6OJZXPDAAP4ukDftRdjq6eRjOw8Lo9oRwDAybo ZQdlX4V3Vi2Rml5AackmUv1m6jHsUn9DNfRyQKkiErOC/ROAkk524UG+65TTjyD3J6UF V6yPvZt0fdBbhE5139cIUaAv6AehG3K4t4c0e5l5wpftlUsE336tlg0fVg6Jkox056oi dJAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XjBjtte0; 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 28si19925196pgy.252.2019.07.08.15.40.54; Mon, 08 Jul 2019 15:41:09 -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=XjBjtte0; 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 S2390831AbfGHPgR (ORCPT + 99 others); Mon, 8 Jul 2019 11:36:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:36368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390485AbfGHPeK (ORCPT ); Mon, 8 Jul 2019 11:34:10 -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 4F33821537; Mon, 8 Jul 2019 15:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562600049; bh=Ksua/iMAduhWu+zLOlCp9/5YnnI7hgB2q1RZ0J0XCFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjBjtte0w3snKjqdw3TP3VU6RW0mX5sidP/1GkK1kmRJKNiT4QXJnb/ysx2ZC3MBF I9I5ZybjgfamdTnGQVnaaYSo+FhScqyinsYiUcEcfGxI1TLzaWTd7FZzDneb6qy2Wd y/u2V8tYmQXPqUP1IhW1zfL8BkeEH94A11glh1CM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Russell King Subject: [PATCH 5.1 77/96] drm/etnaviv: add missing failure path to destroy suballoc Date: Mon, 8 Jul 2019 17:13:49 +0200 Message-Id: <20190708150530.622307378@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@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: Lucas Stach commit be132e1375c1fffe48801296279079f8a59a9ed3 upstream. When something goes wrong in the GPU init after the cmdbuf suballocator has been constructed, we fail to destroy it properly. This causes havok later when the GPU is unbound due to a module unload or similar. Fixes: e66774dd6f6a (drm/etnaviv: add cmdbuf suballocator) Signed-off-by: Lucas Stach Tested-by: Russell King Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -762,7 +762,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu if (IS_ERR(gpu->cmdbuf_suballoc)) { dev_err(gpu->dev, "Failed to create cmdbuf suballocator\n"); ret = PTR_ERR(gpu->cmdbuf_suballoc); - goto fail; + goto destroy_iommu; } /* Create buffer: */ @@ -770,7 +770,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu PAGE_SIZE); if (ret) { dev_err(gpu->dev, "could not create command buffer\n"); - goto destroy_iommu; + goto destroy_suballoc; } if (gpu->mmu->version == ETNAVIV_IOMMU_V1 && @@ -802,6 +802,9 @@ int etnaviv_gpu_init(struct etnaviv_gpu free_buffer: etnaviv_cmdbuf_free(&gpu->buffer); gpu->buffer.suballoc = NULL; +destroy_suballoc: + etnaviv_cmdbuf_suballoc_destroy(gpu->cmdbuf_suballoc); + gpu->cmdbuf_suballoc = NULL; destroy_iommu: etnaviv_iommu_destroy(gpu->mmu); gpu->mmu = NULL;