From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CD6B16D9B8; Mon, 12 Aug 2024 16:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723480261; cv=none; b=a4pB4f3EGZoFBroR02PmRZCO85HTshx5eLE0gaSNztDxUVabSV6kKZU6lUbytuHLj/xegVk1DxtzY3I0/wZ4L9WzcYfM2R5eOfMCJ4zYnnNFXkDWvC991ApVSEPM4eKsqqy3XwOd0FK28FTKMLocJT3fA7dxdp3X84OgJ9ByC+E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723480261; c=relaxed/simple; bh=ltL168FNiT5dtxGou0zg9A0vFk0mfgno8lJIybx+l1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b8Di5l/OT65V65NOGltdTBbaNuFOXFPsxI9gYmRkAMVA6PXhuINX1cP0EZTjL6SbVkalBAvR4AA9qy7NayQW3mKKdDavYx+rRgSbHYJyH9R5d+Y4yLEaUTc7IkSpBqFJjnFThAeeFmgUC63S+2mXvKSPkoNyjWWNP5EMbhGe5G4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DR4K0uuo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DR4K0uuo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDF4DC32782; Mon, 12 Aug 2024 16:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723480261; bh=ltL168FNiT5dtxGou0zg9A0vFk0mfgno8lJIybx+l1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DR4K0uuocxyHpJqIy2NPagLm5njl2lEMIZ2SPQf0wR1rqAY+e3t81xlVIUIU12U4a dDNpbB/GEbe+fNO6I98ctDo2PwtFBaVtRHaPrlV3NqahFahzPAmXHfCOB6lo+SaGO+ U69imyplkfAfdhOMKcdgIpVLUQAKOWVOD/46NGfE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 6.10 143/263] ASoC: codecs: wsa883x: Correct Soundwire ports mask Date: Mon, 12 Aug 2024 18:02:24 +0200 Message-ID: <20240812160152.021716988@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240812160146.517184156@linuxfoundation.org> References: <20240812160146.517184156@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Krzysztof Kozlowski [ Upstream commit 6801ac36f25690e14955f7f9eace1eaa29edbdd0 ] Device has up to WSA883X_MAX_SWR_PORTS number of ports and the array assigned to prop.sink_dpn_prop has 0..WSA883X_MAX_SWR_PORTS-1 elements. On the other hand, GENMASK(high, low) creates an inclusive mask between , so we need the mask from 0 up to WSA883X_MAX_SWR_PORTS-1. Theoretically, too wide mask could cause an out of bounds read in sdw_get_slave_dpn_prop() in stream.c, however only in the case of buggy driver, e.g. adding incorrect number of ports via sdw_stream_add_slave(). Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support") Signed-off-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20240726-asoc-wcd-wsa-swr-ports-genmask-v1-5-d4d7a8b56f05@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wsa883x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c index 5443a5c4100c0..2169d93989841 100644 --- a/sound/soc/codecs/wsa883x.c +++ b/sound/soc/codecs/wsa883x.c @@ -1407,7 +1407,7 @@ static int wsa883x_probe(struct sdw_slave *pdev, WSA883X_MAX_SWR_PORTS)) dev_dbg(dev, "Static Port mapping not specified\n"); - pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS, 0); + pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS - 1, 0); pdev->prop.simple_clk_stop_capable = true; pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; -- 2.43.0