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 9E16718756D; Mon, 12 Aug 2024 16:31:11 +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=1723480271; cv=none; b=L0+pJek9/Nbn/tALgjIM79QcgWp7VyPxkx8GXxSNariqLOYpaRQaUqPoAFjUFK4QAixecGYeQfuXQEQCbh9GnXjb4z9XjLJ70C4r5nUfd6JBZdVmvsW174jCCqb3HFhQgjMdrh9f86rbKNIZzSDBm8mhfzNdCNTPRUF6V7x2iOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723480271; c=relaxed/simple; bh=5lJvFHQeleZSx779yBawUS/dYGItliRLp8opJMffDLU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NkRFQr8SO7SPAYFiKbY0INEDc3QS4y/nSOgOfevXaOQSHOPx5Hwy81EfXo5iBCTtWLu1mMxYFvZ1nAnUajvS7JyC8B17zwIB5dysEB4DMXaMwNaEAg9UH8PZ6Gp51qggict25hbYd4CEJKtn+AmLHXLS6s/q8wMDoAwBP0QAdEI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t/SFHc9L; 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="t/SFHc9L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0622C4AF09; Mon, 12 Aug 2024 16:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723480271; bh=5lJvFHQeleZSx779yBawUS/dYGItliRLp8opJMffDLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/SFHc9LugpIHIdarvfw3wGSEt3Qzs6p4LFJs/JayuoVeyKGznuaVZSZQLeDLKPrk vghrUVPEoiVcIlBcEoc176aCuz4ROrMGAUGB04vFSCQJLc8A7mBMcXs1C6SFDFiGYH altrSX640QhZwXspucUA9SVrVVi+2pYZgt+mS8uY= 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 145/263] ASoC: codecs: wsa884x: Correct Soundwire ports mask Date: Mon, 12 Aug 2024 18:02:26 +0200 Message-ID: <20240812160152.098986348@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 dcb6631d05152930e2ea70fd2abfd811b0e970b5 ] Device has up to WSA884X_MAX_SWR_PORTS number of ports and the array assigned to prop.sink_dpn_prop has 0..WSA884X_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 WSA884X_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: aa21a7d4f68a ("ASoC: codecs: wsa884x: Add WSA884x family of speakers") Signed-off-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20240726-asoc-wcd-wsa-swr-ports-genmask-v1-6-d4d7a8b56f05@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wsa884x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c index a6034547b4f36..de4caf61eef9e 100644 --- a/sound/soc/codecs/wsa884x.c +++ b/sound/soc/codecs/wsa884x.c @@ -1895,7 +1895,7 @@ static int wsa884x_probe(struct sdw_slave *pdev, WSA884X_MAX_SWR_PORTS)) dev_dbg(dev, "Static Port mapping not specified\n"); - pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS, 0); + pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS - 1, 0); pdev->prop.simple_clk_stop_capable = true; pdev->prop.sink_dpn_prop = wsa884x_sink_dpn_prop; pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; -- 2.43.0