Currently, an excessive DisplayPort tunnel may be set up, even if no sufficient credits available. This could lead to malfunctioning DisplayPort tunnel. Fix this and bail out early if this is the case. Fixes: 6ed541c53edc ("thunderbolt: Allocate credits according to router preferences") Cc: stable@vger.kernel.org Signed-off-by: Gil Fine Assisted-by: LLM --- drivers/thunderbolt/tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c index c0342b1d6a8a..7a033df7f916 100644 --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c @@ -1582,7 +1582,7 @@ static int tb_dp_init_video_credits(struct tb_path_hop *hop) */ nfc_credits = port->config.nfc_credits & ADP_CS_4_NFC_BUFFERS_MASK; - if (nfc_credits / sw->min_dp_main_credits > max_dp_streams) + if (nfc_credits / sw->min_dp_main_credits >= max_dp_streams) return -ENOSPC; hop->nfc_credits = sw->min_dp_main_credits; -- 2.43.0