Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3729745pxb; Mon, 24 Jan 2022 16:32:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqlK/1rzwgW4xVEeU/y9MEJObaYI5cxCNR80ITi+r9GHEvg7nZrYgU8D3emuOEUrLvZtG/ X-Received: by 2002:a17:902:b196:b0:14a:43d3:9e76 with SMTP id s22-20020a170902b19600b0014a43d39e76mr16080356plr.100.1643070757719; Mon, 24 Jan 2022 16:32:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643070757; cv=none; d=google.com; s=arc-20160816; b=bm5SUoz9xX1GMTYmrSPk/bRMB6OU/UYFTp3QdTKLZbDYmRbQttDWVuzhMcFB7b5prt J1iSNWBwSBAPaKitO3MBzbbHSfPuav2Yvuk2P/npJ8K3tcW/UkUx/9CuCT5R9pqEXUFh AWP4Z8q2qElC9N50acBYug179Qn9rTV46hf1Pkj7C3ckGVoVv5SlH4qSsaXo53/HLfHj Xesb+2BOjw+1KMWQaZ76f/ayz/YiC340yAfH/93GKBwCY8KnTT8eqz84Xjuwg7yYgj1l Kt46xTOF2g5mKRO6rb1ARE8PiFGH6U9bCV3IoK9G0y4TqFaP/M0ZRBNmAbVeOLkXR/PR rteQ== 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=VCMWIXmnPmRTcigY+kjgBNivvslo3uswzd96g6mSTo0=; b=xaKe+CJAmrLj3/Pr4qoUNFRpcWN4iJKbMLF60O93rGgSUxJKxpMEne5RZBKEWYXWxT 3NrjIlmHClB9BbvU9LFTJ3dA9pnOTKI6/x4V7U1T4QbCcIYhYaQY9w64c5zaJhzctV4f 3wb/kmenZEtCjR9wiAhh7IHUWF0e6h/kcm81jSPCfoPILACC+6+UxnECpe2jHey4+e1C 7x+tyYX1H7HAm3G/bVyYRg/iUVGtSU9SbdOqPdu7cObZlae7NIdsyiqTRPGh/oVZtApO S444TYvBWWidhsOu1kgJXLr0aUS+azp+ma1XTZOWybNneozslzyOblTl81NMGU6YHEwj /jkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DC3y3AaZ; 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 h184si7080854pge.170.2022.01.24.16.32.25; Mon, 24 Jan 2022 16:32:37 -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=DC3y3AaZ; 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 S3410205AbiAYA2p (ORCPT + 99 others); Mon, 24 Jan 2022 19:28:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387192AbiAXXeJ (ORCPT ); Mon, 24 Jan 2022 18:34:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B2D7C07597F; Mon, 24 Jan 2022 13:36:12 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 38C9DB8121C; Mon, 24 Jan 2022 21:36:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D8C2C340E4; Mon, 24 Jan 2022 21:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060170; bh=nlpsVFFBLXH+IEIkEIU95YTgMgVg2K0Hj1A5Aq2u94E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DC3y3AaZ+AbIaeAHwep9VUnqMyojbvA7GbjpAx6kay5AvrdZMlGq4iWGq1wNCP+Dk wpivzixp1pZANCBiKUM/chkn3BZXRXY3vm2yzxgQqNTbi6pPgsXH1tRAY83j7Cb5u1 2iejhdn89phDH/spQX24pZtxbQIBbwcylGT4Xzls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yizhuo Zhai , Alex Deucher Subject: [PATCH 5.16 0861/1039] drm/amd/display: Fix the uninitialized variable in enable_stream_features() Date: Mon, 24 Jan 2022 19:44:10 +0100 Message-Id: <20220124184154.238652206@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Yizhuo Zhai commit 0726ed3065eeb910f9cea0c933bc021a848e00b3 upstream. In function enable_stream_features(), the variable "old_downspread.raw" could be uninitialized if core_link_read_dpcd() fails, however, it is used in the later if statement, and further, core_link_write_dpcd() may write random value, which is potentially unsafe. Fixes: 6016cd9dba0f ("drm/amd/display: add helper for enabling mst stream features") Cc: stable@vger.kernel.org Signed-off-by: Yizhuo Zhai Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -1844,6 +1844,8 @@ static void enable_stream_features(struc union down_spread_ctrl old_downspread; union down_spread_ctrl new_downspread; + memset(&old_downspread, 0, sizeof(old_downspread)); + core_link_read_dpcd(link, DP_DOWNSPREAD_CTRL, &old_downspread.raw, sizeof(old_downspread));