Skip to content

Commit dcb6631

Browse files
krzkbroonie
authored andcommitted
ASoC: codecs: wsa884x: Correct Soundwire ports mask
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 <high, low>, 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: aa21a7d ("ASoC: codecs: wsa884x: Add WSA884x family of speakers") Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://patch.msgid.link/20240726-asoc-wcd-wsa-swr-ports-genmask-v1-6-d4d7a8b56f05@linaro.org Signed-off-by: Mark Brown <[email protected]>
1 parent 6801ac3 commit dcb6631

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/soc/codecs/wsa884x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ static int wsa884x_probe(struct sdw_slave *pdev,
18951895
WSA884X_MAX_SWR_PORTS))
18961896
dev_dbg(dev, "Static Port mapping not specified\n");
18971897

1898-
pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS, 0);
1898+
pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS - 1, 0);
18991899
pdev->prop.simple_clk_stop_capable = true;
19001900
pdev->prop.sink_dpn_prop = wsa884x_sink_dpn_prop;
19011901
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;

0 commit comments

Comments
 (0)