Received: by 10.213.65.68 with SMTP id h4csp500637imn; Fri, 16 Mar 2018 09:38:48 -0700 (PDT) X-Google-Smtp-Source: AG47ELsKt9xWXMIIOO1A/fuNT8z/z/SKtj9+TWfsInun3SPoq0AfrM6/9UgWe5QHdfeYOGkwBiLU X-Received: by 10.101.100.141 with SMTP id e13mr1980561pgv.333.1521218328673; Fri, 16 Mar 2018 09:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218328; cv=none; d=google.com; s=arc-20160816; b=myVnBKRVyc9pDHgShIumMQ7q3VPd8pq99ZgqVFqcJwMdiwxi5Fbjvq5Tj510QuYVgW VKkSek1wqT7b7GLaZ8sny90TMGC/g7IM0JAqlGjQi3ChI0JluHzLgegj5xXPvS+VcJj5 Jq+Vd2cMFAmCqarsq2Q+dtLZYHQR7RoAjg0z9qd4YzR+pWmeMVehzL96QwZkKaKQeZ0i 1VdrxY8il9CVtR9IgmpFse5QCmGQrL1schthLB/Ys3n6QcAlRegOB89V60BgMufzfXDn Z4fEquxvlSzYvoFyr+9X8oA1PZPZ+nesOAbwapPoNDCaUc4bNacA20cIJudZCng/mN+R ABkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xi/QLXe2HxqEO6XxAEOVjOJj4hp9y1ilB7s2PaqOJ+0=; b=t5PPyThmzmxScIz+yBApC7ed54NP+C4fm1v2txoiem7Eq2WIL8rDOOx7zwuuXUx/xB 1EtC5jvUPaWwvno7LyXIUW4SZBigakAOjA2zdMrHfnmHBjyEP8NFRpvh6LxVCKrk0Jwl Bl8bxpmBaJwydp14/u68T+hUl6tAc5vgSXBURhVNuIwWRsi2cUhuMnNrG9DqtSwK/6XH h0sHw1VBml17FGJ26I6JeNtkvUmG+IZsodcYDT+n25y+FeSznfp/PWat+oELy3s5DVL7 4oDnt3Q9cpbymDiugdZId8sEPggmp1IKR6fUf6pzXlWkuxDEwhttsw0nTkW/jwNLLhiQ BiqA== ARC-Authentication-Results: i=1; mx.google.com; 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 b13si5664529pfi.53.2018.03.16.09.38.34; Fri, 16 Mar 2018 09:38:48 -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; 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 S934410AbeCPPhP (ORCPT + 99 others); Fri, 16 Mar 2018 11:37:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40800 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934376AbeCPPhM (ORCPT ); Fri, 16 Mar 2018 11:37:12 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0151E1221; Fri, 16 Mar 2018 15:37:10 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Monk Liu , Alex Deucher , Sasha Levin Subject: [PATCH 4.14 075/109] drm/amdgpu:fix virtual dce bug Date: Fri, 16 Mar 2018 16:23:44 +0100 Message-Id: <20180316152334.052644249@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Monk Liu [ Upstream commit 129d65c18ecfb249aceb540c31fdaf79bd5a11ff ] this fix the issue that access memory after freed after driver unloaded. Signed-off-by: Monk Liu Acked-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c @@ -437,6 +437,8 @@ static int dce_virtual_sw_fini(void *han drm_kms_helper_poll_fini(adev->ddev); drm_mode_config_cleanup(adev->ddev); + /* clear crtcs pointer to avoid dce irq finish routine access freed data */ + memset(adev->mode_info.crtcs, 0, sizeof(adev->mode_info.crtcs[0]) * AMDGPU_MAX_CRTCS); adev->mode_info.mode_config_initialized = false; return 0; } @@ -723,7 +725,7 @@ static void dce_virtual_set_crtc_vblank_ int crtc, enum amdgpu_interrupt_state state) { - if (crtc >= adev->mode_info.num_crtc) { + if (crtc >= adev->mode_info.num_crtc || !adev->mode_info.crtcs[crtc]) { DRM_DEBUG("invalid crtc %d\n", crtc); return; }