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 81F80337B81; Wed, 8 Apr 2026 18:54: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=1775674487; cv=none; b=NInPdCZlC6EwJYOKMb1EnUkTAmxilyItK2nBv3OVLG/m0YS0AFwE9ew8+Dh5wdofE/K+NRMJ3u5c0iPDNa2C6tkJTm3eW5+ylnmYVfL/9fmhl3hk2H4U9gq80cjPAp9kWnlD8hGNxacAIsrngiiwqHG0HoTkV/YQ1svvfCrQ4mM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775674487; c=relaxed/simple; bh=Rd73IHcCEawuZlcuAXLqRk+JQHzpL2Hepil0ezqL5tY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k+dKnwHz86YhCJCnbIeNv0x8gF9JsH+GCuzYJ73cXN4PVdngFuVvul2XwCcmlz9AElEgOR/TwdRgH46rdj2D5Bh6cYiPg1TWjwM+RYrhrY4KxasKZtKz7Ogsp3v8Og0VAedzOdH1HkTZXHN9QW1fRbDTgMmghS/Hh7/JXyWL9hs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QkchbDSt; 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="QkchbDSt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9E19C19421; Wed, 8 Apr 2026 18:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775674487; bh=Rd73IHcCEawuZlcuAXLqRk+JQHzpL2Hepil0ezqL5tY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QkchbDStii+sPPisvxpBB4ypiYkB0AFoI81YFkSSfo3xZPVYOQ4TnYyXsj237yTwC 6oK+k3IMw2hQp2JLxDWSNBAxE0cx+7EKVbpq5sGmLUHY4Q0BWoQLf405MU6eMnyLt7 PXplcticf2kVcv6Jkkt5eCWQS11er+Qkgj9U271U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Martin Schiller , Paolo Abeni , Sasha Levin Subject: [PATCH 6.19 117/311] net/x25: Fix potential double free of skb Date: Wed, 8 Apr 2026 20:01:57 +0200 Message-ID: <20260408175943.786559112@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175939.393281918@linuxfoundation.org> References: <20260408175939.393281918@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Schiller [ Upstream commit d10a26aa4d072320530e6968ef945c8c575edf61 ] When alloc_skb fails in x25_queue_rx_frame it calls kfree_skb(skb) at line 48 and returns 1 (error). This error propagates back through the call chain: x25_queue_rx_frame returns 1 | v x25_state3_machine receives the return value 1 and takes the else branch at line 278, setting queued=0 and returning 0 | v x25_process_rx_frame returns queued=0 | v x25_backlog_rcv at line 452 sees queued=0 and calls kfree_skb(skb) again This would free the same skb twice. Looking at x25_backlog_rcv: net/x25/x25_in.c:x25_backlog_rcv() { ... queued = x25_process_rx_frame(sk, skb); ... if (!queued) kfree_skb(skb); } Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Martin Schiller Link: https://patch.msgid.link/20260331-x25_fraglen-v4-1-3e69f18464b4@dev.tdt.de Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/x25/x25_in.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index b981a4828d08c..0dbc73efab1cb 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c @@ -44,10 +44,9 @@ static int x25_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more) if (x25->fraglen > 0) { /* End of fragment */ int len = x25->fraglen + skb->len; - if ((skbn = alloc_skb(len, GFP_ATOMIC)) == NULL){ - kfree_skb(skb); + skbn = alloc_skb(len, GFP_ATOMIC); + if (!skbn) return 1; - } skb_queue_tail(&x25->fragment_queue, skb); -- 2.53.0