Commit e2d124de authored by Mark Brown's avatar Mark Brown

ASoC: codecs: wcd93xx/wsa88xx: Correct Soundwire ports

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:

Incorrect mask of Soundwire ports - one bit too long/big - was passed.

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().

Not adding Cc-stable because I don't think the issue can lead to real
out-of-bounds read.
parents 45d763fe dcb6631d
...@@ -1049,7 +1049,7 @@ static int wcd9370_probe(struct sdw_slave *pdev, ...@@ -1049,7 +1049,7 @@ static int wcd9370_probe(struct sdw_slave *pdev,
pdev->prop.lane_control_support = true; pdev->prop.lane_control_support = true;
pdev->prop.simple_clk_stop_capable = true; pdev->prop.simple_clk_stop_capable = true;
if (wcd->is_tx) { if (wcd->is_tx) {
pdev->prop.source_ports = GENMASK(WCD937X_MAX_TX_SWR_PORTS, 0); pdev->prop.source_ports = GENMASK(WCD937X_MAX_TX_SWR_PORTS - 1, 0);
pdev->prop.src_dpn_prop = wcd937x_dpn_prop; pdev->prop.src_dpn_prop = wcd937x_dpn_prop;
wcd->ch_info = &wcd937x_sdw_tx_ch_info[0]; wcd->ch_info = &wcd937x_sdw_tx_ch_info[0];
pdev->prop.wake_capable = true; pdev->prop.wake_capable = true;
...@@ -1062,7 +1062,7 @@ static int wcd9370_probe(struct sdw_slave *pdev, ...@@ -1062,7 +1062,7 @@ static int wcd9370_probe(struct sdw_slave *pdev,
/* Start in cache-only until device is enumerated */ /* Start in cache-only until device is enumerated */
regcache_cache_only(wcd->regmap, true); regcache_cache_only(wcd->regmap, true);
} else { } else {
pdev->prop.sink_ports = GENMASK(WCD937X_MAX_SWR_PORTS, 0); pdev->prop.sink_ports = GENMASK(WCD937X_MAX_SWR_PORTS - 1, 0);
pdev->prop.sink_dpn_prop = wcd937x_dpn_prop; pdev->prop.sink_dpn_prop = wcd937x_dpn_prop;
wcd->ch_info = &wcd937x_sdw_rx_ch_info[0]; wcd->ch_info = &wcd937x_sdw_rx_ch_info[0];
} }
......
...@@ -1252,12 +1252,12 @@ static int wcd9380_probe(struct sdw_slave *pdev, ...@@ -1252,12 +1252,12 @@ static int wcd9380_probe(struct sdw_slave *pdev,
pdev->prop.lane_control_support = true; pdev->prop.lane_control_support = true;
pdev->prop.simple_clk_stop_capable = true; pdev->prop.simple_clk_stop_capable = true;
if (wcd->is_tx) { if (wcd->is_tx) {
pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0); pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS - 1, 0);
pdev->prop.src_dpn_prop = wcd938x_dpn_prop; pdev->prop.src_dpn_prop = wcd938x_dpn_prop;
wcd->ch_info = &wcd938x_sdw_tx_ch_info[0]; wcd->ch_info = &wcd938x_sdw_tx_ch_info[0];
pdev->prop.wake_capable = true; pdev->prop.wake_capable = true;
} else { } else {
pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0); pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS - 1, 0);
pdev->prop.sink_dpn_prop = wcd938x_dpn_prop; pdev->prop.sink_dpn_prop = wcd938x_dpn_prop;
wcd->ch_info = &wcd938x_sdw_rx_ch_info[0]; wcd->ch_info = &wcd938x_sdw_rx_ch_info[0];
} }
......
...@@ -1453,12 +1453,12 @@ static int wcd9390_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) ...@@ -1453,12 +1453,12 @@ static int wcd9390_probe(struct sdw_slave *pdev, const struct sdw_device_id *id)
pdev->prop.lane_control_support = true; pdev->prop.lane_control_support = true;
pdev->prop.simple_clk_stop_capable = true; pdev->prop.simple_clk_stop_capable = true;
if (wcd->is_tx) { if (wcd->is_tx) {
pdev->prop.source_ports = GENMASK(WCD939X_MAX_TX_SWR_PORTS, 0); pdev->prop.source_ports = GENMASK(WCD939X_MAX_TX_SWR_PORTS - 1, 0);
pdev->prop.src_dpn_prop = wcd939x_tx_dpn_prop; pdev->prop.src_dpn_prop = wcd939x_tx_dpn_prop;
wcd->ch_info = &wcd939x_sdw_tx_ch_info[0]; wcd->ch_info = &wcd939x_sdw_tx_ch_info[0];
pdev->prop.wake_capable = true; pdev->prop.wake_capable = true;
} else { } else {
pdev->prop.sink_ports = GENMASK(WCD939X_MAX_RX_SWR_PORTS, 0); pdev->prop.sink_ports = GENMASK(WCD939X_MAX_RX_SWR_PORTS - 1, 0);
pdev->prop.sink_dpn_prop = wcd939x_rx_dpn_prop; pdev->prop.sink_dpn_prop = wcd939x_rx_dpn_prop;
wcd->ch_info = &wcd939x_sdw_rx_ch_info[0]; wcd->ch_info = &wcd939x_sdw_rx_ch_info[0];
} }
......
...@@ -1152,7 +1152,7 @@ static int wsa881x_probe(struct sdw_slave *pdev, ...@@ -1152,7 +1152,7 @@ static int wsa881x_probe(struct sdw_slave *pdev,
wsa881x->sconfig.frame_rate = 48000; wsa881x->sconfig.frame_rate = 48000;
wsa881x->sconfig.direction = SDW_DATA_DIR_RX; wsa881x->sconfig.direction = SDW_DATA_DIR_RX;
wsa881x->sconfig.type = SDW_STREAM_PDM; 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.sink_dpn_prop = wsa_sink_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
pdev->prop.clk_stop_mode1 = true; pdev->prop.clk_stop_mode1 = true;
......
...@@ -1406,7 +1406,7 @@ static int wsa883x_probe(struct sdw_slave *pdev, ...@@ -1406,7 +1406,7 @@ static int wsa883x_probe(struct sdw_slave *pdev,
WSA883X_MAX_SWR_PORTS)) WSA883X_MAX_SWR_PORTS))
dev_dbg(dev, "Static Port mapping not specified\n"); 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.simple_clk_stop_capable = true;
pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
......
...@@ -1895,7 +1895,7 @@ static int wsa884x_probe(struct sdw_slave *pdev, ...@@ -1895,7 +1895,7 @@ static int wsa884x_probe(struct sdw_slave *pdev,
WSA884X_MAX_SWR_PORTS)) WSA884X_MAX_SWR_PORTS))
dev_dbg(dev, "Static Port mapping not specified\n"); 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.simple_clk_stop_capable = true;
pdev->prop.sink_dpn_prop = wsa884x_sink_dpn_prop; pdev->prop.sink_dpn_prop = wsa884x_sink_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment