From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49300342CA7; Sat, 30 May 2026 17:48:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780163314; cv=none; b=HmdEnCbnFLvSF2u2Am3U3z2zxukG8+dlq0sxig2CEqOPjA9XaUr8dW0u90n3X9O4Eh/T6H+/w/0upFtGPup19ZyTn89Q5xt8x6rWnuV7cMNJkCuVZIgD0X8RtJODHXhjtXlshKyuSfC6oK9TxXpn7bkKWgDQkFvKhoOyBr+lIks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780163314; c=relaxed/simple; bh=Ni99gC9Nd2nkR7PFZIr5006BWWZMbRQo59WntSuqu14=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u4KxfnC0W2m8fttFyo3v46Lu9JmXGq2AX0lGPAXliGWV3z5oASw1GZ6lzy/yuL9LPcWRp5FXvq0kDTIW0VflEbHAfpPiMEgtsxio5QbAgTCyh4T7pQrbypzCsAwKagPT5qv6v1MK7mm2om3kmwmYNgc8Ll8wlkLudRpLsWFaDnY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Wxrq14Yr; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Wxrq14Yr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3B71F00893; Sat, 30 May 2026 17:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780163313; bh=Ink75ea+don9y8UkVVB3GeuxuvAS3A4KVDQeUKGjebk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Wxrq14YrFmaGTjS+Pplqhugy7dncg4mn0E4jWWkAJTNECKiSqz+rIT8NbriE6ezZ7 QQtFU17Xt3HBPSH68VTo/CZbId0XlLKC7Lz8j75F18TGL4t+J9aJ+CMK1rz9JoiA+U J2EYreLtOE5hCzRjDmH5/kZXwyKCvFUGEL6xo7Po= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Yuan Tan , Yifan Wu , Juefei Pu , Xin Liu , Ruijie Li , Ren Wei , Dust Li , Jakub Kicinski Subject: [PATCH 5.15 220/776] net/smc: avoid early lgr access in smc_clc_wait_msg Date: Sat, 30 May 2026 17:58:54 +0200 Message-ID: <20260530160246.207381326@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ruijie Li commit 5a8db80f721deee8e916c2cfdee78decda02ce4f upstream. A CLC decline can be received while the handshake is still in an early stage, before the connection has been associated with a link group. The decline handling in smc_clc_wait_msg() updates link-group level sync state for first-contact declines, but that state only exists after link group setup has completed. Guard the link-group update accordingly and keep the per-socket peer diagnosis handling unchanged. This preserves the existing sync_err handling for established link-group contexts and avoids touching link-group state before it is available. Fixes: 0cfdd8f92cac ("smc: connection and link group creation") Cc: stable@kernel.org Reported-by: Yuan Tan Reported-by: Yifan Wu Reported-by: Juefei Pu Reported-by: Xin Liu Signed-off-by: Ruijie Li Signed-off-by: Ren Wei Reviewed-by: Dust Li Link: https://patch.msgid.link/08c68a5c817acf198cce63d22517e232e8d60718.1776850759.git.ruijieli51@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/smc/smc_clc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -440,8 +440,8 @@ int smc_clc_wait_msg(struct smc_sock *sm dclc = (struct smc_clc_msg_decline *)clcm; reason_code = SMC_CLC_DECL_PEERDECL; smc->peer_diagnosis = ntohl(dclc->peer_diagnosis); - if (((struct smc_clc_msg_decline *)buf)->hdr.typev2 & - SMC_FIRST_CONTACT_MASK) { + if ((dclc->hdr.typev2 & SMC_FIRST_CONTACT_MASK) && + smc->conn.lgr) { smc->conn.lgr->sync_err = 1; smc_lgr_terminate_sched(smc->conn.lgr); }