summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/tunnel.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2023-03-31 13:01:32 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-05-24 09:39:34 +0300
commit814c96c959cfc147ecf8bf9ae3f34b8361316316 (patch)
tree9c0508d7c4e51bf7b342e5036cbdf2d3bae4c272 /drivers/thunderbolt/tunnel.c
parent44c026a73be8038f03dbdeef028b642880cf1511 (diff)
downloadlinux-stable-814c96c959cfc147ecf8bf9ae3f34b8361316316.tar.gz
linux-stable-814c96c959cfc147ecf8bf9ae3f34b8361316316.tar.bz2
linux-stable-814c96c959cfc147ecf8bf9ae3f34b8361316316.zip
thunderbolt: Check for ring 0 in tb_tunnel_alloc_dma()
Ring 0 cannot be used for anything else than control channel messages. For this reason add a check to tb_tunnel_alloc_dma() and fail if someone tries to do that. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tunnel.c')
-rw-r--r--drivers/thunderbolt/tunnel.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index 9099ae73e78f..dd3b5613ad2c 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -1452,6 +1452,10 @@ struct tb_tunnel *tb_tunnel_alloc_dma(struct tb *tb, struct tb_port *nhi,
struct tb_path *path;
int credits;
+ /* Ring 0 is reserved for control channel */
+ if (WARN_ON(!receive_ring || !transmit_ring))
+ return NULL;
+
if (receive_ring > 0)
npaths++;
if (transmit_ring > 0)