Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp729115imm; Thu, 13 Sep 2018 06:56:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYytkPBYQ3m3memWuDFi5ys4PMTtGGFW54iwKBq9yN7PhEl/hH3oL8SYvWenJKXO1JC+Jxy X-Received: by 2002:a17:902:464:: with SMTP id 91-v6mr7539680ple.125.1536847002561; Thu, 13 Sep 2018 06:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847002; cv=none; d=google.com; s=arc-20160816; b=df7QetI2dv6V1snJA32+0rOYTReaTomW6KXT38kkopvoJIcEzIqi0+YHUp4/gDcZPL 15AKq9+NzSwnNIZelR99wlD8uOk2YfcegEnMYeWVANcczQ6efRPFzMq/unV0qsBNrSX8 4PfgNlYWGlYuHopwa+z6K2QJhHZmHhRfiqmdjx0pbhLmdOoAODve/9ZPIkrW6NwnxMil 1MwxKoLpwT9jNyVYy/A0a5NVKy0TqUVwQcRueDQ+AlPphZftY4cOkoZ7x/Wrxjxj3m7a W738uALIj6xD3dnvQDTcp1g8tCOZ/LnOESzU9P/9MllUQg69XURpGXNYq9lIKJiYPVA6 6Zxg== 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; bh=mQUZEGg822/Xfhx4IR2qTZd8h9KhsmWnrBkkqvoj5uY=; b=mTN6PtgJMqw7kTzUmkRqN8Nq57D/FVyWf84l7D2LeIfb9b1OQ/GtCke6kjrXni8xpW jFUU1PEmDevamG0/p1W+wXbZh/wplsDBS55Z1dLwbtOu6mzuokGqUio4ofHlz/eaKwpJ EsN4TVyiHN1dhLcHqULjR3HnzdLn7NALCQ1ALPZiJb7bH3YGnwj/CSpms2NclTIbkOes 3ICpXVtYbSv1z6/WFAKirvCMXCoMjOBlq76zhRvdY3LDCPkqoU987PQxb7oD7qyy5RcE akyX1nSyK3iVrXhi21oZOFYOs3BJQDpERCz/eDCIFL3lb4eBUyUsd4VL2oeyFRyISyJx ooDw== 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 h4-v6si4284809pgc.429.2018.09.13.06.56.27; Thu, 13 Sep 2018 06:56:42 -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 S1731363AbeIMTFs (ORCPT + 99 others); Thu, 13 Sep 2018 15:05:48 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34130 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729823AbeIMTFs (ORCPT ); Thu, 13 Sep 2018 15:05:48 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D9090CE7; Thu, 13 Sep 2018 13:56:11 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Kazlauskas , Sun peng Li , Leo Li , Alex Deucher , Sasha Levin Subject: [PATCH 4.18 085/197] drm/amd/display: Guard against null crtc in CRC IRQ Date: Thu, 13 Sep 2018 15:30:34 +0200 Message-Id: <20180913131844.929316601@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Kazlauskas [ Upstream commit dddc0557e3a02499ce336b1e2e67f5afaecccc80 ] [Why] A null pointer deference can occur if crtc is null in amdgpu_dm_crtc_handle_crc_irq. This can happen if get_crtc_by_otg_inst returns NULL during dm_crtc_high_irq, leading to a hang in some IGT test cases. [How] Check that CRTC is non-null before accessing its fields. Signed-off-by: Nicholas Kazlauskas Reviewed-by: Sun peng Li Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c @@ -98,10 +98,16 @@ int amdgpu_dm_crtc_set_crc_source(struct */ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc) { - struct dm_crtc_state *crtc_state = to_dm_crtc_state(crtc->state); - struct dc_stream_state *stream_state = crtc_state->stream; + struct dm_crtc_state *crtc_state; + struct dc_stream_state *stream_state; uint32_t crcs[3]; + if (crtc == NULL) + return; + + crtc_state = to_dm_crtc_state(crtc->state); + stream_state = crtc_state->stream; + /* Early return if CRC capture is not enabled. */ if (!crtc_state->crc_enabled) return;