From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0C86035A3AD; Mon, 4 May 2026 14:20:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904448; cv=none; b=JBHWt4jxWTIVj77bAixo/FTZXi+7DWMtTwP6NxWeCMzuLLed0VDxbpwjFM/meIK5ceRCykHvju9tSPSTxkAyHGSC1ZVxzGEJgfXRi39FK/IL1G1Io/uTbConxrqOoz4qNcThSE1KUEEEgtsFNYQu5kGcD/0qksUvu3NRL5/9NF8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904448; c=relaxed/simple; bh=hWAt4RQmPCkyZcUZ6DCcN2Vp+9glGG74zVA9vKyJfRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X0iurz7p3bzjzQVkxtGUbZV1EuwMJDtK7gmycjVG/0CQoZGYs/xjQraaxCoO78+SX6X4c/ECgR9veHm4xF13T9AVWttrtr2iRCCZuYsckYCxJ1RpecrzUmWDS9jHDTmRM+IbCzCFCbIiPqW2LBINr0Mc+/lDlEC7E92MNDphvMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1gTUY+Hv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1gTUY+Hv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49FE4C2BCB8; Mon, 4 May 2026 14:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777904447; bh=hWAt4RQmPCkyZcUZ6DCcN2Vp+9glGG74zVA9vKyJfRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1gTUY+Hv7ysL0rTPaS58F58Pavh2gAk8VHlRAmTmjh1TNq2V1FdFs3HaihMDC4iMB TNn6NPZm58SvhGEPocvXgXSccZ6P3C9GNBjI0xrTNivxrYGiO55GcMmu+lRi5yt1z0 BecAvpIMel1jW+f2fK2TCh595NT8or41PY/zey+w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Yifan Wu , Juefei Pu , Yuan Tan , Xin Liu , Luxiao Xu , Ren Wei , Paolo Abeni Subject: [PATCH 6.12 043/215] net: strparser: fix skb_head leak in strp_abort_strp() Date: Mon, 4 May 2026 15:51:02 +0200 Message-ID: <20260504135131.754019984@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504135130.169210693@linuxfoundation.org> References: <20260504135130.169210693@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Luxiao Xu commit fe72340daaf1af588be88056faf98965f39e6032 upstream. When the stream parser is aborted, for example after a message assembly timeout, it can still hold a reference to a partially assembled message in strp->skb_head. That skb is not released in strp_abort_strp(), which leaks the partially assembled message and can be triggered repeatedly to exhaust memory. Fix this by freeing strp->skb_head and resetting the parser state in the abort path. Leave strp_stop() unchanged so final cleanup still happens in strp_done() after the work and timer have been synchronized. Fixes: 43a0c6751a32 ("strparser: Stream parser for messages") Cc: stable@kernel.org Reported-by: Yifan Wu Reported-by: Juefei Pu Co-developed-by: Yuan Tan Signed-off-by: Yuan Tan Suggested-by: Xin Liu Tested-by: Yuan Tan Signed-off-by: Luxiao Xu Signed-off-by: Ren Wei Link: https://patch.msgid.link/ade3857a9404999ce9a1c27ec523efc896072678.1775482694.git.rakukuip@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/strparser/strparser.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c @@ -45,6 +45,14 @@ static void strp_abort_strp(struct strpa strp->stopped = 1; + if (strp->skb_head) { + kfree_skb(strp->skb_head); + strp->skb_head = NULL; + } + + strp->skb_nextp = NULL; + strp->need_bytes = 0; + if (strp->sk) { struct sock *sk = strp->sk;