From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752613AbdLGRmc (ORCPT ); Thu, 7 Dec 2017 12:42:32 -0500 Received: from fldsmtpe03.verizon.com ([140.108.26.142]:60877 "EHLO fldsmtpe03.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756063AbdLGPtm (ORCPT ); Thu, 7 Dec 2017 10:49:42 -0500 From: alexander.levin@verizon.com Cc: Dave Airlie , Alex Deucher , alexander.levin@verizon.com X-Host: endeavour.tdc.vzwcorp.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 019/156] drm/amdgpu: fix parser init error path to avoid crash in parser fini Thread-Topic: [PATCH AUTOSEL for 4.9 019/156] drm/amdgpu: fix parser init error path to avoid crash in parser fini Thread-Index: AQHTb3LlhI1ocpDUG0iCjyG/WHlZSA== Date: Thu, 7 Dec 2017 15:48:58 +0000 Message-ID: <20171207154845.4814-19-alexander.levin@verizon.com> References: <20171207154845.4814-1-alexander.levin@verizon.com> In-Reply-To: <20171207154845.4814-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vB7HgfDQ001362 From: Dave Airlie [ Upstream commit 607523d19c9d67ba4cf7bdaced644f11ed04992c ] If we don't reset the chunk info in the error path, the subsequent fini path will double free. Reviewed-by: Christian König Signed-off-by: Dave Airlie Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index bfb4b91869e7..f26d1fd53bef 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -240,6 +240,8 @@ free_partial_kdata: for (; i >= 0; i--) drm_free_large(p->chunks[i].kdata); kfree(p->chunks); + p->chunks = NULL; + p->nchunks = 0; put_ctx: amdgpu_ctx_put(p->ctx); free_chunk: -- 2.11.0