]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Aug 2024 06:22:32 +0000 (08:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Aug 2024 06:22:32 +0000 (08:22 +0200)
added patches:
soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch

queue-5.10/series
queue-5.10/soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch [new file with mode: 0644]

index 695ffd1b6b9c5ccfb5cac021417366aeeb86d041..0c46bd85292f3ef6043a40024cb39a87ab936096 100644 (file)
@@ -134,3 +134,4 @@ ata-libata-core-fix-null-pointer-dereference-on-error.patch
 cgroup-cpuset-prevent-uaf-in-proc_cpuset_show.patch
 net-rds-fix-possible-deadlock-in-rds_message_put.patch
 ovl-do-not-fail-because-of-o_noatime.patch
+soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch
diff --git a/queue-5.10/soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch b/queue-5.10/soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch
new file mode 100644 (file)
index 0000000..f1d9869
--- /dev/null
@@ -0,0 +1,58 @@
+From ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Date: Mon, 29 Jul 2024 16:01:57 +0200
+Subject: soundwire: stream: fix programming slave ports for non-continous port maps
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+
+commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 upstream.
+
+Two bitmasks in 'struct sdw_slave_prop' - 'source_ports' and
+'sink_ports' - define which ports to program in
+sdw_program_slave_port_params().  The masks are used to get the
+appropriate data port properties ('struct sdw_get_slave_dpn_prop') from
+an array.
+
+Bitmasks can be non-continuous or can start from index different than 0,
+thus when looking for matching port property for given port, we must
+iterate over mask bits, not from 0 up to number of ports.
+
+This fixes allocation and programming slave ports, when a source or sink
+masks start from further index.
+
+Fixes: f8101c74aa54 ("soundwire: Add Master and Slave port programming")
+Cc: stable@vger.kernel.org
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20240729140157.326450-1-krzysztof.kozlowski@linaro.org
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/soundwire/stream.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/soundwire/stream.c
++++ b/drivers/soundwire/stream.c
+@@ -1425,18 +1425,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_p
+                                           unsigned int port_num)
+ {
+       struct sdw_dpn_prop *dpn_prop;
+-      u8 num_ports;
++      unsigned long mask;
+       int i;
+       if (direction == SDW_DATA_DIR_TX) {
+-              num_ports = hweight32(slave->prop.source_ports);
++              mask = slave->prop.source_ports;
+               dpn_prop = slave->prop.src_dpn_prop;
+       } else {
+-              num_ports = hweight32(slave->prop.sink_ports);
++              mask = slave->prop.sink_ports;
+               dpn_prop = slave->prop.sink_dpn_prop;
+       }
+-      for (i = 0; i < num_ports; i++) {
++      for_each_set_bit(i, &mask, 32) {
+               if (dpn_prop[i].num == port_num)
+                       return &dpn_prop[i];
+       }