Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1D2DC77B7F for ; Mon, 1 May 2023 03:04:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A65210E2AE; Mon, 1 May 2023 03:04:25 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id A87A910E2AE; Mon, 1 May 2023 03:04:24 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1AF83617BB; Mon, 1 May 2023 03:04:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DE01C433EF; Mon, 1 May 2023 03:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682910263; bh=rHfZgXmub3sL7eQF8zYXl7n5PUDBaia/tORS/AvOlO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WK55X84feVD4ozppLzTmuh1q1NfC0tCQdXgYY1ZBVv5pDewV2QmG0XTNKJh2GQE5x fJJl6aT7tPzwXqy3Vww22+kYbeejYjcol7xfk9ACyfuCUO6xBzMYwZ8SBpvPxFacC3 /v9UkrNHj67sMB9t4uyaQ6ldC/X74mL/8p0eIPALyi3E1Om+FmiGaDd18j0L9PEFtW B654Llp7Ky3w7i9V9JJ2OY0UlVfMdTdt7CuRKEEAXrwTq/ljptCGQN852XWGpdAYZL t+yPcm2wg6+91DIOV14KY9dW/LctP2zQiVflP8URGwd4FW6cazVx+ZEE6Acg0CbxuE AJI3nwUKKbddg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 30/33] drm/amd: Fix an out of bounds error in BIOS parser Date: Sun, 30 Apr 2023 23:02:24 -0400 Message-Id: <20230501030227.3254266-30-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501030227.3254266-1-sashal@kernel.org> References: <20230501030227.3254266-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , erhard_f@mailbox.org, tales.aparecida@gmail.com, chiahsuan.chung@amd.com, dri-devel@lists.freedesktop.org, Charlene.Liu@amd.com, sunpeng.li@amd.com, airlied@gmail.com, sancchen@amd.com, Xinhui.Pan@amd.com, Rodrigo.Siqueira@amd.com, amd-gfx@lists.freedesktop.org, tony.tascioglu@amd.com, aurabindo.pillai@amd.com, Mario Limonciello , daniel@ffwll.ch, george.shen@amd.com, Alex Deucher , Harry Wentland , christian.koenig@amd.com Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Mario Limonciello [ Upstream commit d116db180decec1b21bba31d2ff495ac4d8e1b83 ] The array is hardcoded to 8 in atomfirmware.h, but firmware provides a bigger one sometimes. Deferencing the larger array causes an out of bounds error. commit 4fc1ba4aa589 ("drm/amd/display: fix array index out of bound error in bios parser") fixed some of this, but there are two other cases not covered by it. Fix those as well. Reported-by: erhard_f@mailbox.org Link: https://bugzilla.kernel.org/show_bug.cgi?id=214853 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2473 Signed-off-by: Mario Limonciello Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index 074e70a5c458e..e507d2e1410b7 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -516,11 +516,8 @@ static enum bp_result get_gpio_i2c_info( info->i2c_slave_address = record->i2c_slave_addr; /* TODO: check how to get register offset for en, Y, etc. */ - info->gpio_info.clk_a_register_index = - le16_to_cpu( - header->gpio_pin[table_index].data_a_reg_index); - info->gpio_info.clk_a_shift = - header->gpio_pin[table_index].gpio_bitshift; + info->gpio_info.clk_a_register_index = le16_to_cpu(pin->data_a_reg_index); + info->gpio_info.clk_a_shift = pin->gpio_bitshift; return BP_RESULT_OK; } -- 2.39.2