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 732BF305680; Fri, 15 May 2026 15:57:48 +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=1778860668; cv=none; b=mrfCb/wFgJclOxK3Uld9NzrPXwJ9+JiV+2FyNKv7pzkZJCbqSeIwIzpaDbZfJkaowgTagKywFvGWF4vR76gv8IgVndr62pbMYD6tYcTmpws/k0I9yPUBor2FfBeeiy4r0b66w7i/83OhK2YHvSgJQ2xJa/ofSkIFUq1YS3ncALk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778860668; c=relaxed/simple; bh=Sc25wYxnYkErbrfsmq7n9VuQNcO2OP+T6Cigl0H7e04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t4esQDlCsqPdqeiTdz58hxlUmylv/o1U1S+wO3q0bUU4s/pldWKrPTmx3Hw09BxcM7NwP2JE9re9mRNdwwl8yXq61kbIYAI7A3pnvLO8FUvDItaxEMU6vN9Zjit/JZE1MTQxypfXMyyA52Tpv6V9JbccDdsDL+Gw5qwHFhgmi88= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wCafB418; 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="wCafB418" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 090B7C2BCB0; Fri, 15 May 2026 15:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778860668; bh=Sc25wYxnYkErbrfsmq7n9VuQNcO2OP+T6Cigl0H7e04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wCafB418HN8F/bOQHENm2Jz2ioKwlWs8IEULaOddtOSJID0zHTn75o3T37lA3TVuK 8Y/zX5umjafWndab/aqmwzbQe8iXxWuHEDZa1Vrbft3NUvWe18tEhjB2S6OeAIGGx2 xyUw1PcKrvPXVHqIdQreVovnZxtB8KzETSuhVnbM= 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.6 034/474] net: strparser: fix skb_head leak in strp_abort_strp() Date: Fri, 15 May 2026 17:42:23 +0200 Message-ID: <20260515154715.787199483@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515154715.053014143@linuxfoundation.org> References: <20260515154715.053014143@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.6-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;