Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796215810; b=5lbTHaBveNQwFqmLlUlCToTlz4b0QFGnOe2M6Yi1k/WJHyXhWutMtDqr7cWjGCC6I1vI by44Lcnx1V7JKph36xfjK5X3dipgekrntq1fLKGYCAHWoJ5DcDQY+NA9DvC2yCCx3xnEM LtjuLNpxd6YvVErRzr33VTPO+MaWkpKuZPMFIriD+gxMLS5w4NrJ5oH2l3cYFMTmJdIGu 2zVJ/nn/slwdrqYro2JvziM64/8oyeneaiKivu8AhX5k/tiHI5VJCeCrleL14UjKBUwhF SbDQZuVYi+zL8hhEt9OpJwBmerltexyDMu/VAXzwUscZqCvw4Hv3GJ+j9PA3fSBh6Dw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796215810; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=SF+qfgl7y/CiBbGREdppWQYpqwpsb2mWT8RX6+4oedo=; b=WvUv5PwyCUhfccXr9DYHl41PVmaLSqwAJWaxDthwvtzQuMXkYqVdOfSJ7nn4Jc9xHHbu XVL4qeqQr8Y52JIB8ue6RDQSOFr6y5jUfid2GZV1rqN+ZaB/Q6euioZw9VktOABDAawp0 pLIOcrL6zQ+1t0WY936JrSIedZG8f0ZaBtUJVW+tWYG8HPxWFu6fPfFxW7gTbbisQfulO 6e/QW+a3VUBcfyrAoW5el0Q++5UUzQlQ3drF2Dv2WgARynxpadTJmA+Po320jlS1GDRBr a0lNuH9CMzk8y040tkDy7htzoQrdWm7Xj3AGXMmcn0VXWo+1HADe5jadYIiOSGs0qLQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XGhFLnx7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2FB3606A327 for ; Wed, 2 Dec 2026 12:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XGhFLnx7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 030921F00924; Wed, 2 Dec 2026 12:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796215809; bh=SF+qfgl7y/CiBbGREdppWQYpqwpsb2mWT8RX6+4oedo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=XGhFLnx7lbWL6U7ZBKXKwqmwZ14rk28Qv6nRLMojbEpLsJ6vAikHghirAbnN3NMO9 C5xgmsdhMYWfzamtYKRtNibMjSogFcia9enN1XE9kzVv46WcIVTkVi0hV4ueyulp8L YLSMCJfeXLM+tIOBnlXPxLT0bhR38AQI06+BdUEjXPl8WrlVFnbRuHHTUZBwmCOP2i dwSVH0qZMXt/zY0Q9zh16aDleh0Rcj7L09MxKqox73uKKDg1/TalLoaGuH9yeP0rmG AL4CZFnff43DL6D5We9HY/fcRRlt/SDtSEDHsNfUwuWL5lCxuSMiJ4MXqLsaODzY3a sHhjixvCA1Adw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/3] RDMA/cm: add ib_cm_reject_pending_connect() Reply-To: sashiko-reviews@lists.linux.dev To: "Stefan Metzmacher" , linux-rdma@vger.kernel.org Cc: "Chuck Lever" , "Jeff Layton" , "Anna Schumaker" In-Reply-To: <82e30641e75a574b3f98766b63cc603ebf0b8222.1796215022.git.metze@samba.org> References: <82e30641e75a574b3f98766b63cc603ebf0b8222.1796215022.git.metze@samba.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 12:50:08 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] RDMA/cm: unmatchable REJ sent before REP in ib_cm_reject_pending_connect() -- commit 4b27fca63a8905d689ea7a1a5659bc7e21ff263b Author: Stefan Metzmacher RDMA/cm: add ib_cm_reject_pending_connect() This commit adds ib_cm_reject_pending_connect() to atomically check the CM state, reject a pending active connection under cm_id_priv->lock, and return the prior state to the caller. > diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c > index d16fc71ed5e6c..9d43097a6ef02 100644 > --- a/drivers/infiniband/core/cm.c > +++ b/drivers/infiniband/core/cm.c > @@ -3025,6 +3025,40 @@ int ib_send_cm_rej(struct ib_cm_id *cm_id, enum ib= _cm_rej_reason reason, > } > EXPORT_SYMBOL(ib_send_cm_rej); > =20 > +int ib_cm_reject_pending_connect(struct ib_cm_id *cm_id, > + enum ib_cm_state *old_state) > +{ > + struct cm_id_private *cm_id_priv =3D > + container_of(cm_id, struct cm_id_private, id); > + unsigned long flags; > + int ret =3D -EINVAL; > + > + spin_lock_irqsave(&cm_id_priv->lock, flags); > + *old_state =3D cm_id->state; > + switch (cm_id->state) { > + case IB_CM_REQ_SENT: > + case IB_CM_MRA_REQ_RCVD: > + case IB_CM_REP_RCVD: > + case IB_CM_MRA_REP_SENT: > + /* > + * cm_send_rej_locked() moves the cm_id to IB_CM_IDLE > + * before it sends the REJ, so the connect is aborted > + * even if sending the REJ fails, the peer then > + * notices via its own timeout. > + */ > + cm_send_rej_locked(cm_id_priv, IB_CM_REJ_CONSUMER_DEFINED, > + NULL, 0, NULL, 0); > + ret =3D 0; > + break; [Severity: High] Does sending IB_CM_REJ_CONSUMER_DEFINED with a NULL ARI in IB_CM_REQ_SENT and IB_CM_MRA_REQ_RCVD produce a REJ MAD that the passive peer cannot match? Before a REP arrives, cm_id_priv->id.remote_id is still 0. On the passive side, cm_acquire_rejected_id() only looks up the connection by the remote CA GUID in the ARI and remote_id when the reason is IB_CM_REJ_TIMEOUT: drivers/infiniband/core/cm.c:cm_acquire_rejected_id() { if (IBA_GET(CM_REJ_REASON, rej_msg) =3D=3D IB_CM_REJ_TIMEOUT) { cm_id_priv =3D cm_find_remote_id( *((__be64 *)IBA_GET_MEM_PTR(CM_REJ_ARI, rej_msg)), remote_id); } else if (IBA_GET(CM_REJ_MESSAGE_REJECTED, rej_msg) =3D=3D CM_MSG_RESPONSE_REQ) cm_id_priv =3D cm_acquire_id( cpu_to_be32(IBA_GET(CM_REJ_REMOTE_COMM_ID, rej_msg)), 0); else cm_id_priv =3D cm_acquire_id( cpu_to_be32(IBA_GET(CM_REJ_REMOTE_COMM_ID, rej_msg)), remote_id); } With IB_CM_REJ_CONSUMER_DEFINED, cm_acquire_rejected_id() takes the final else branch with CM_REJ_REMOTE_COMM_ID =3D=3D 0, fails to find the cm_id, a= nd drops the REJ. Because cm_send_rej_locked() also resets cm_id->state to IB_CM_IDLE, a later cm_destroy_id() will no longer send the IB_CM_REJ_TIMEOUT with node_guid in the ARI that it previously sent, leaving the passive peer's connection and REP retries dangling until they time out. Should IB_CM_REQ_SENT and IB_CM_MRA_REQ_RCVD pass IB_CM_REJ_TIMEOUT and &cm_id_priv->id.device->node_guid in the ARI, matching cm_destroy_id()? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796215022.gi= t.metze@samba.org?part=3D2