Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979910pxb; Fri, 5 Mar 2021 04:40:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyb9x9NEXmAcJJl0zx2HZckQV+AldhqUecd5dKpoW78pvPo69JZs0olURaLRA1Nr2P/dU5J X-Received: by 2002:a17:907:9808:: with SMTP id ji8mr211768ejc.333.1614948035985; Fri, 05 Mar 2021 04:40:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614948035; cv=none; d=google.com; s=arc-20160816; b=twgvqI1zdaQdBpw1YYMBdrKdS0cNCUoskISP0lRQNR5GOA9XqKAkKZhdGWugBjUvr1 83JPjlP+7M/Na8FBTnMVkw/PkdjQSljKu6Thi96qpehCbLJcpkEV/o8oid2Vt8Y64SR2 3YdWUo4jvPXhFGve+3IJgRlaxFJbR/N3g7UJ95gcRw/d5iwRYWtqO3Mjgk6kDYnkRlak YCf0H2ITQZR6XhHnDX4PVTLazaah1eSz6i7RXbuo/pbeaH4Kcq72QD8D2kUdRcGIAWA5 /oUT4LIseaUBT3dIsy1O3DPB9lkiUiiGi9vCoKi2v4ell8tXvMCdxLDy7dgyy8TnUIX7 wKvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lKbquT2+BnFi5QLjAZKsQY4lxHs8YfETePeYfmYaaeg=; b=M3MiMj0yRc3dPansMIW1LNIFf1F01Ub1xcVCEYn6+eAN3f/1jCcWeRUCo8d+KCADI6 RcGyVYkjSXX1iBTylArKAZjj/KYxb1XtU2aOsfS7uFfx5Tsc4JXPAPDGqeSMkKw+GoMN g47/f4ESjtkLXI0lBCrfLcw3nwnbrMMVwO9+JU2KYLOR0FP9b65VKnLbHPs+Jpljg1Tq e9Ne4eFWqMPMSXM96GTiB0YDj/VcTOdzlkcYCbU90iyvUJZMZe7+ETCvGQtUv7GLL/Jx xgC3lQnyfb/0A9NTJKiucfWHnNp4VA+K/nnhgX12yXsWSPw8hF/GRA9riEogT8LGEBRr aIXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NlffRs5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bn9si1268803ejb.23.2021.03.05.04.40.13; Fri, 05 Mar 2021 04:40:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NlffRs5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233274AbhCEMjM (ORCPT + 99 others); Fri, 5 Mar 2021 07:39:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:52118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230462AbhCEMie (ORCPT ); Fri, 5 Mar 2021 07:38:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B70A165012; Fri, 5 Mar 2021 12:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947913; bh=1JkpQNtZ3SdC0LsOZyLxa+V3Yxg6V5nE2CLt/WhrWlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NlffRs5WanOdsHrYi5UPlekxdNNwvcG16iJzEenrF1hBoovU07nqW49N/XsPfhCBb MNEICVB4xS19WS8NjNNVLKD743TEeAtMzksWIRF++RPwlaad0k8hzfT+yGad5gXZ+d kkPz3oHyKogHZgunW9qRP4WJmGMq8f6rbWYs83Eg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Nicholas Kazlauskas , Eric Yang , Anson Jacob , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 33/52] drm/amd/display: Guard against NULL pointer deref when get_i2c_info fails Date: Fri, 5 Mar 2021 13:22:04 +0100 Message-Id: <20210305120855.298573239@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120853.659441428@linuxfoundation.org> References: <20210305120853.659441428@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Kazlauskas [ Upstream commit 44a09e3d95bd2b7b0c224100f78f335859c4e193 ] [Why] If the BIOS table is invalid or corrupt then get_i2c_info can fail and we dereference a NULL pointer. [How] Check that ddc_pin is not NULL before using it and log an error if it is because this is unexpected. Tested-by: Daniel Wheeler Signed-off-by: Nicholas Kazlauskas Reviewed-by: Eric Yang Acked-by: Anson Jacob Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index fa0e6c8e2447..e3bedf4cc9c0 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -1124,6 +1124,11 @@ static bool construct( goto ddc_create_fail; } + if (!link->ddc->ddc_pin) { + DC_ERROR("Failed to get I2C info for connector!\n"); + goto ddc_create_fail; + } + link->ddc_hw_inst = dal_ddc_get_line( dal_ddc_service_get_ddc_pin(link->ddc)); -- 2.30.1