From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14515C433DB for ; Wed, 23 Dec 2020 02:25:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 763B62336D for ; Wed, 23 Dec 2020 02:25:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 763B62336D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E97C817DE; Wed, 23 Dec 2020 03:24:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E97C817DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1608690323; bh=+wJUFYaFYeKD3BKxzQ9mNJZkS6nkCiu7oo1clnzeQVI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Aaesri6VwnbD8wEF4PGeT70XLasFGBbgCidN6FEwu7n+7ny6Oo3z9YbowvDcB71RU tkFw7QBg4Rxkg5346UdRM2sooraOnU5DJgSJ/GvJiiS1PwMB6SY9tINqyOmh50wTv+ TU82iowj2pdlgJ/Eu4frgl/IooLX488NUunl7ZXQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B2C7DF801EB; Wed, 23 Dec 2020 03:24:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5EDDCF801EC; Wed, 23 Dec 2020 03:24:18 +0100 (CET) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 19E8CF800BC for ; Wed, 23 Dec 2020 03:24:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 19E8CF800BC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MiW4HIQI" Received: by mail.kernel.org (Postfix) with ESMTPSA id E2D6223137; Wed, 23 Dec 2020 02:24:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690254; bh=+wJUFYaFYeKD3BKxzQ9mNJZkS6nkCiu7oo1clnzeQVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MiW4HIQIMmJhX6mPh5LsDTL9N5/+zGRxMiJM2Xd76AQNGGs1baQgcFBdV7rKfDK9E MH0LFAmfMrWSIv3mbE3IJwvNDlcLa9nqtUrBAJCXJCpCr+ZNE9Ii/AUq4M0IyACZk6 76phY020Z87F0kuN5Iry8+6t45UjGgJRPmxbIDvqz0NhU00hLAATF+RVAvC3ff1efu asjGJC2TbpsTrdjQyaQ7JREXqOMat1jBE/mxUnVvO0s0P0ZJxz+e0WPaafBr/a+Sy+ /J7antnXyD3EONcOggZaP/h7ody3ThCnNH7hbdkXgwSriem4fkfjJep0Mb2yX7RIqd bmKdsinGiszuA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 65/66] ALSA: hda/hdmi: packet buffer index must be set before reading value Date: Tue, 22 Dec 2020 21:22:51 -0500 Message-Id: <20201223022253.2793452-65-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223022253.2793452-1-sashal@kernel.org> References: <20201223022253.2793452-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Cc: Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org, Kai Vehmanen X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Kai Vehmanen [ Upstream commit 46c3bbd9827952f92e250fa6ee30a797a4c4e17e ] The check for infoframe transmit status in hdmi_infoframe_uptodate() makes the assumption that packet buffer index is set to zero. Align code with specification and explicitly set the index before AC_VERB_GET_HDMI_DIP_XMIT. The packet index setting affects both DIP-Data and DIP-XmitCtrl verbs. There are no known cases where the old implementation has caused driver to work incorrectly. This change is purely based on code review against the specification (HDA spec rev1.0a). Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20201211131613.3271407-1-kai.vehmanen@linux.intel.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 21d9b7d96eb0f..35da926507ac3 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -642,11 +642,11 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, u8 val; int i; + hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) != AC_DIPXMIT_BEST) return false; - hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); for (i = 0; i < size; i++) { val = snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_DATA, 0); -- 2.27.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEB9AC4321A for ; Wed, 23 Dec 2020 02:36:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 951B5223E4 for ; Wed, 23 Dec 2020 02:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729041AbgLWCg3 (ORCPT ); Tue, 22 Dec 2020 21:36:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:52758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730238AbgLWCYa (ORCPT ); Tue, 22 Dec 2020 21:24:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E2D6223137; Wed, 23 Dec 2020 02:24:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690254; bh=+wJUFYaFYeKD3BKxzQ9mNJZkS6nkCiu7oo1clnzeQVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MiW4HIQIMmJhX6mPh5LsDTL9N5/+zGRxMiJM2Xd76AQNGGs1baQgcFBdV7rKfDK9E MH0LFAmfMrWSIv3mbE3IJwvNDlcLa9nqtUrBAJCXJCpCr+ZNE9Ii/AUq4M0IyACZk6 76phY020Z87F0kuN5Iry8+6t45UjGgJRPmxbIDvqz0NhU00hLAATF+RVAvC3ff1efu asjGJC2TbpsTrdjQyaQ7JREXqOMat1jBE/mxUnVvO0s0P0ZJxz+e0WPaafBr/a+Sy+ /J7antnXyD3EONcOggZaP/h7ody3ThCnNH7hbdkXgwSriem4fkfjJep0Mb2yX7RIqd bmKdsinGiszuA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kai Vehmanen , Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 4.14 65/66] ALSA: hda/hdmi: packet buffer index must be set before reading value Date: Tue, 22 Dec 2020 21:22:51 -0500 Message-Id: <20201223022253.2793452-65-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223022253.2793452-1-sashal@kernel.org> References: <20201223022253.2793452-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kai Vehmanen [ Upstream commit 46c3bbd9827952f92e250fa6ee30a797a4c4e17e ] The check for infoframe transmit status in hdmi_infoframe_uptodate() makes the assumption that packet buffer index is set to zero. Align code with specification and explicitly set the index before AC_VERB_GET_HDMI_DIP_XMIT. The packet index setting affects both DIP-Data and DIP-XmitCtrl verbs. There are no known cases where the old implementation has caused driver to work incorrectly. This change is purely based on code review against the specification (HDA spec rev1.0a). Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20201211131613.3271407-1-kai.vehmanen@linux.intel.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 21d9b7d96eb0f..35da926507ac3 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -642,11 +642,11 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, u8 val; int i; + hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) != AC_DIPXMIT_BEST) return false; - hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); for (i = 0; i < size; i++) { val = snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_DATA, 0); -- 2.27.0