All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] thunderbolt: Check for ring 0 in tb_tunnel_alloc_dma()
@ 2023-05-17  8:40 Mika Westerberg
  2023-05-17  8:40 ` [PATCH 2/7] thunderbolt: Log function name of the called quirk Mika Westerberg
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Mika Westerberg @ 2023-05-17  8:40 UTC (permalink / raw)
  To: linux-usb
  Cc: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever,
	Mika Westerberg

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>
---
 drivers/thunderbolt/tunnel.c | 4 ++++
 1 file changed, 4 insertions(+)

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)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-24  6:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17  8:40 [PATCH 1/7] thunderbolt: Check for ring 0 in tb_tunnel_alloc_dma() Mika Westerberg
2023-05-17  8:40 ` [PATCH 2/7] thunderbolt: Log function name of the called quirk Mika Westerberg
2023-05-17  8:40 ` [PATCH 3/7] thunderbolt: Add debug log for link controller power quirk Mika Westerberg
2023-05-17  8:41 ` [PATCH 4/7] thunderbolt: Allow specifying custom credits for DMA tunnels Mika Westerberg
2023-05-17  8:41 ` [PATCH 5/7] thunderbolt: Add MODULE_DESCRIPTION Mika Westerberg
2023-05-17  8:41 ` [PATCH 6/7] thunderbolt: dma_test: Update MODULE_DESCRIPTION Mika Westerberg
2023-05-17  8:41 ` [PATCH 7/7] thunderbolt: Drop retimer vendor check Mika Westerberg
2023-05-24  6:42 ` [PATCH 1/7] thunderbolt: Check for ring 0 in tb_tunnel_alloc_dma() Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.