From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f13.google.com (mail-pj2-f13.google.com [74.125.227.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2AF4718CF for ; Tue, 15 Sep 2026 09:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.141 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789465906; cv=none; b=RwyD6NQ32uteWknEyOCLo/U1qA79CaEp8Z7g6PGQ6+rgQDwI8y8OX/eQHCCai/0Du/quSW3JO9NlNO25z1l+2YgnCsiay/cvT6Qxc/O9Y/2tGtVYMpG/I+JPvRn7G+AHrOqxdX5WOYaC/FoCDG2MGzjLpFtUzu/v2Mvbgn8G2H0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789465906; c=relaxed/simple; bh=SjnPd3F4xaIZYIfBs7KNh1DDK816y1zDiNw5ZDtQAPk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=jnN+Kc8DUig1MNdoQ6tkyguGFWl3XMooJEIx8Hukv5+C+SUInXyMhisSsUCxR5XQzTAUNrOdBODoLEOmXr3bkRuJlz8iHdi9+HAJYeVjtLzleyO+Eic8ds3mQCIB4+qyT4ZSPyA9e7LDsmLxg+tFiUgBb+FB+W77nwwA6mj4SkM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FeNI27/T; arc=none smtp.client-ip=74.125.227.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FeNI27/T" Received: by mail-pj2-f13.google.com with SMTP id 98e67ed59e1d1-39dfcef2896so139728a91.0 for ; Tue, 15 Sep 2026 02:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789465904; x=1790070704; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=zczTvM2RkZrNADCe5tPZcKwAKp4jsVncoMtfbJjwrvY=; b=FeNI27/TAYWdUo/oMlN1jpikw1GJKysuU7I6dQ0T4qes5BycbsveuVYZ7XKodMuhOi +uZWpKhVIw7fO+uTp31bU7EUCQPV6l7cgGdYK+E6YiyvGeWGkNY0VhY5poWSm1HvjlLw AY+F8dSGOJ+hXBVKT6pT83rzgaVfpm4QTErlilhJaUcKuE9yDTOOjrxOwSe+Zmx9A6CT oS8xMhApQreYSOyLrLAlzRoP4s9v5e0S9bc0xApqbQ2N40pkEXLZl8RVEqvLKvH/+t7K iazTiqhxYyRPmDPAOTamrTPTBZkr8pnnkgUyAM3gKmfHcY4G3GskgY0zBwhdyDDSLlt3 e1Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789465904; x=1790070704; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zczTvM2RkZrNADCe5tPZcKwAKp4jsVncoMtfbJjwrvY=; b=e3308ByTTw4Gd06co8NGpUSa8eaFRprQ6nmUEejvcTYB2fkho/3Boeg2nMMD6UEmHx mw/DXIiHIioybK8TlyQn6/PKfDvfV51rHrZ2ZJ0vyUpWyskynrxQCgs2D4lv7Mapj7W7 vodwGLaE/IHDXTamDwH9KWkMiG6Jab3DFxevsNy6bvoQf72XnMXUICPGLiTUoCvEHUol /THLGD7e4vN/1EETY4bFFtWlC6+mgvZWE+NO/hbWYlw4jaV5En8JUaXBzzKu97yTLQwL tsQwdeAkLkKd4uFQAeJUnQfvH5cZDSZ/Y8jP2ZlEubAHR7BFihTreyOBGwT9/Csvo554 yJiQ== X-Forwarded-Encrypted: i=1; AKwUvBx4P6JKBSAJCDgXjIMhQbmb7B4aSj6+7tJuwn7a8+eg8/I8EswGX8X4eiRSqRkzlOs/LGuALdU=@vger.kernel.org X-Gm-Message-State: AFuF++mupB5cRBoBK8HI+8r1wThkCRmufR/7iLL7jPHOO1GfTV/31NcC doIkSFONC4/JZWBkOZpTO8pZ+HYMIH2hdowOinY9KRaUAFyLZdDxhi6FmiO0VOjIAUNXlg== X-Gm-Gg: AYBFou1JN4Y1VKvZPO4ygcqYfN8+RHkYjtEme1cAbO0lMOm0Nwh/MO+KnJY/yYESpTa 1q/NyQ6kX0PG4+w375DaH+qkocy+0tkPmRUnsDtiogYh/9cGPxdfdvZsVGcrmnP6rjhltSnnWld g3x2512sxPPSbMZ6A6xsDJgQYdOrLmsr0q9R3aATJqyTtlEmpR5yguuVBweeWMD8QGly8AtYZnU N4RUY/4ZdcrzfxgavoVNSSuWztwCPOueNfwH/gEGQ9Yo6T+GVkfvdAK2wE1nqnJ3yQJT0GP/n5H xd/tMOW7MtIzi3cSyIf1hYxFrI7wGpepJnXZLoIsvlaDMi9UFsj1sq+RTJVdltpk0ftHT782gEX wNXc7XoMnfOCE3he7asoQ40SqnbuK0rBR3QSej5FkeAnp6/rWSbvvLBvYM9w6PpXdgzaL+ZdbJI xSITCZ7Tw+mcgOHJs4RrvaGa1Z9x3aTQJyrP/4CPx0qQw7lifxi0jWV3GL08CO4Z4946oIKEcEQ 0c1udHmtjgoaCKPDemhQGWBQ3qheeuqeyxNBgkk X-Received: by 2002:a17:90b:440c:b0:381:bcfb:e710 with SMTP id 98e67ed59e1d1-39dec137c0emr9047736a91.3.1789465904285; Tue, 15 Sep 2026 02:51:44 -0700 (PDT) Received: from localhost.localdomain ([189.1.242.96]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfb8c09cesm1438633a91.1.2026.09.15.02.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 02:51:43 -0700 (PDT) From: Yiqi Sun To: lucien.xin@gmail.com Cc: marcelo.leitner@gmail.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-sctp@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, stable@vger.kernel.org, sunyiqixm@hotmai.com, Yiqi Sun Subject: [PATCH v3 net] sctp: avoid livelock while updating retransmit path Date: Tue, 15 Sep 2026 17:50:17 +0800 Message-Id: <20260915095017.942213-1-sunyiqixm@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit sctp_assoc_update_retran_path() can loop forever when every remaining transport, including retran_path, is SCTP_UNCONFIRMED: the state check runs before the wraparound test, so the loop cannot observe that it has completed a full pass. Fix this by considering a transport only when it is not UNCONFIRMED, then checking whether the walk has returned to retran_path. This makes the full-pass termination independent of the transport state while preserving the existing fallback selection semantics. Also restore the NULL guard around the retran_path assignment. In the all-UNCONFIRMED case there is no eligible replacement transport, and installing NULL would leave later retransmit-path users and the debug print with a NULL path. Fixes: 4c47af4d5eb2 ("net: sctp: rework multihoming retransmission path selection to rfc4960") Signed-off-by: Yiqi Sun --- Changes in v3: - Post as a new, independent thread. - Drop quoted review discussion and the reproducer attachment claim from the commit message. - Link to v2: https://lore.kernel.org/r/20260902025206.phbpyxmpf4zrtdpx@sunyiqi-llm-kernel/ --- net/sctp/associola.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/net/sctp/associola.c b/net/sctp/associola.c index c0512c827d0f..4521be3bd85a 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -1289,18 +1289,19 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc) /* Manually skip the head element. */ if (&trans->transports == &asoc->peer.transport_addr_list) continue; - if (trans->state == SCTP_UNCONFIRMED) - continue; - trans_next = sctp_trans_elect_best(trans, trans_next); - /* Active is good enough for immediate return. */ - if (trans_next->state == SCTP_ACTIVE) - break; + if (trans->state != SCTP_UNCONFIRMED) { + trans_next = sctp_trans_elect_best(trans, trans_next); + /* Active is good enough for immediate return. */ + if (trans_next->state == SCTP_ACTIVE) + break; + } /* We've reached the end, time to update path. */ if (trans == asoc->peer.retran_path) break; } - asoc->peer.retran_path = trans_next; + if (trans_next) + asoc->peer.retran_path = trans_next; pr_debug("%s: association:%p updated new path to addr:%pISpc\n", __func__, asoc, &asoc->peer.retran_path->ipaddr.sa); -- 2.34.1