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 9088319FA90; Thu, 15 Aug 2024 14:00:36 +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=1723730436; cv=none; b=gGgL7MJZoVdaQFNdi7F2rAPKmInudXEnYFlgfBjkTnSy0pJDUVe2BVXvYRXYWZqeNK44C6z9GoYeWDTBgIQGUmGy3IFlfX0idcv6s/mJWuZUGZDbZO2uRUSEX9FdvZi4N4mrYh22V0KB5aDsVmODWin47PD8XaK8gf7kdaaVZ9I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723730436; c=relaxed/simple; bh=TWGlmdt/sipPhXsPbkg8zuCYYqB9LF6axRwgcuz52gk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NbbYnk1fBVoCiaWSEFWx67H8FgfKGNNCvVZ+lzVamypsTG3TBiyUS3K44mRAlWtndatASNsaJHWVIbLE1gGQuShwDSa3ujOoE51yPOO7G4NYFeEfHfI0SjfHheWMLj6ZopYpX4bOewdOpL20Os6I2i+E54WyzOSaaoBfu1tYn3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Bd6M3l+2; 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="Bd6M3l+2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1BD4C4AF0C; Thu, 15 Aug 2024 14:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723730436; bh=TWGlmdt/sipPhXsPbkg8zuCYYqB9LF6axRwgcuz52gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bd6M3l+2oxDTmiL0ZWijp4WQyj60Gzd6/7vCpEbvWzbW0wHGI/HeiHw6An/tEFJy9 2D3wvHZYhMgubiau5bDPUlyyA5KEu5kQVw8CqNequks47IuhImxzE8WsnUpOB4Mmyy g3X4k278k8dgWTWpTVvp4iKHCXtZoQMCvNuZkC60= 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 5.15 408/484] ASoC: codecs: wsa881x: Correct Soundwire ports mask Date: Thu, 15 Aug 2024 15:24:26 +0200 Message-ID: <20240815131957.209739796@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240815131941.255804951@linuxfoundation.org> References: <20240815131941.255804951@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Krzysztof Kozlowski [ Upstream commit eb11c3bb64ad0a05aeacdb01039863aa2aa3614b ] Device has up to WSA881X_MAX_SWR_PORTS number of ports and the array assigned to prop.sink_dpn_prop has 0..WSA881X_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 WSA881X_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: a0aab9e1404a ("ASoC: codecs: add wsa881x amplifier support") Signed-off-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20240726-asoc-wcd-wsa-swr-ports-genmask-v1-4-d4d7a8b56f05@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wsa881x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 8559047694873..c8d3dc6341037 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -1120,7 +1120,7 @@ static int wsa881x_probe(struct sdw_slave *pdev, wsa881x->sconfig.frame_rate = 48000; wsa881x->sconfig.direction = SDW_DATA_DIR_RX; wsa881x->sconfig.type = SDW_STREAM_PDM; - pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0); + pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS - 1, 0); pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; gpiod_direction_output(wsa881x->sd_n, 1); -- 2.43.0