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 B97522DC783; Mon, 17 Aug 2026 14:44:36 +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=1786977877; cv=none; b=VWCZZjXyyAwnT49iVttnEJK+fzawbYg7Z6OuNB+C7uTtxXILtnjF5uUqNttPdMyFmUSFb/1wCMKAqcdHLTtitdUD++EbZNmUT80v/klhRAj4FLTpE9LTGAOvR33Hx66wWiRb7iE8b19ggCYomTSZ6udl6u3+gKn/ib6RE7ZZTQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786977877; c=relaxed/simple; bh=obnIyvEF98uY353dF3O5LO+9gHsI/yiN/a9A1l2CwG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b8/EQtltwD/9gSKEPuP9KNHcJydjBMOu4YxAr0Bd/SZQFE85tHvoaYvsnBSdoT/eeRMME3jQVn6DlUXqh6IbO5V3cBXYsI132XJQqFfmJGM7VXzFSocB9U99QoxK9fTh8Dp3z5c/R5QsE1F3WahlzEazeyz/hs29gJcO5qbILYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gkBbVNcA; 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="gkBbVNcA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2278D1F000E9; Mon, 17 Aug 2026 14:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786977876; bh=SfIy1cclEhvGyb4BySiHhyQdulSETA3fJjhhJvn4E84=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gkBbVNcAzfaLPq9Q6QAEBLTxnfdbMWr1FmWlCFjTgMsUkj0omXlGQONj429T/rr+n PjOrSW3o1/QQHH9RxyHhPvMd3rrJ9ppZJ81jHHTum6d72gr0aTSu6RptDOGUAr+ecO 1ezXoBKeClSBum/cXNCmTOaCe8Hc/ga6XZ8Yd+Po= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mahanta Jambigi , Hidayath Khan , Sidraya Jayagond , Dust Li , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 024/181] net/smc: fix qentry overwrite for CONFIRM_LINK and ADD_LINK_CONT in smc_llc_event_handler() Date: Mon, 17 Aug 2026 15:31:58 +0200 Message-ID: <20260817132536.334081688@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132535.394764707@linuxfoundation.org> References: <20260817132535.394764707@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mahanta Jambigi [ Upstream commit 976245094925bab9bc39366b2e9ab44ffcde61d0 ] The SMC_LLC_CONFIRM_LINK / SMC_LLC_ADD_LINK_CONT branch in smc_llc_event_handler() stores an incoming qentry into the local LLC flow without first checking whether a qentry is already pending. If a malicious or buggy peer sends a second CONFIRM_LINK or ADD_LINK_CONT request while a flow is active and flow->qentry is already set, smc_llc_flow_qentry_set() overwrites the pointer without freeing the previous allocation, leaking one kmalloc-96 object per spurious message. The sibling SMC_LLC_DELETE_LINK branch already has the correct !flow->qentry guard. Apply the same guard to the CONFIRM_LINK/ADD_LINK_CONT branch so that a duplicate message when qentry is already occupied falls through to break and is freed by the kfree(qentry) at the out: label, rather than silently leaking the existing allocation. The response direction (smc_llc_rx_response()) is unaffected: it already guards with flow->qentry at the equivalent site and drops duplicate responses correctly. Fixes: 0fb0b02bd6fd ("net/smc: adapt SMC client code to use the LLC flow") Signed-off-by: Mahanta Jambigi Reviewed-by: Hidayath Khan Reviewed-by: Sidraya Jayagond Reviewed-by: Dust Li Link: https://patch.msgid.link/20260729130153.970800-1-mjambigi@linux.ibm.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/smc/smc_llc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c index 018ce8133b026..149d63cff667e 100644 --- a/net/smc/smc_llc.c +++ b/net/smc/smc_llc.c @@ -1918,7 +1918,8 @@ static void smc_llc_event_handler(struct smc_llc_qentry *qentry) return; case SMC_LLC_CONFIRM_LINK: case SMC_LLC_ADD_LINK_CONT: - if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE) { + if (lgr->llc_flow_lcl.type != SMC_LLC_FLOW_NONE && + !lgr->llc_flow_lcl.qentry) { /* a flow is waiting for this message */ smc_llc_flow_qentry_set(&lgr->llc_flow_lcl, qentry); wake_up(&lgr->llc_msg_waiter); -- 2.53.0