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 9D14813A272; Tue, 14 May 2024 11:05:11 +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=1715684711; cv=none; b=XmxXzdBgxqlzJer6m4le+H39uu20oeJlB0uN8RFlNlM1xL0pnTI17Y20m2tI8fpKKl73Ey6HbUyE0oMMprHmkWa2VA8h/UwjKRDLqvWRpb89IC91hqkEr9Dli8MSPUQ8yVisi2zqZW6EFvH0dBQ3b/5PFBtUDhZ1P2hStzcy72A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715684711; c=relaxed/simple; bh=7YHYwzmdaAU7fUPLXhIU3IVdbl9iTJP3VyZwFL5CD0c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uQLtYIfJGcVHxVOo8xj7TqaCDL4yyIwEVIApT9F8+e0mVBwgsC1xXpcALiNG6FC0cH4EB3bezG2bqMvkWh6Z/c8ofsET37yl8ug8p31790MUrew4kS6emcKnA8DFCeHbN5cp1+FtRTRCy8SDRFZtrrLIwnNc5cPYVB+XGRwdM1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Sq+NLo53; 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="Sq+NLo53" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64183C32782; Tue, 14 May 2024 11:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1715684711; bh=7YHYwzmdaAU7fUPLXhIU3IVdbl9iTJP3VyZwFL5CD0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sq+NLo531ZoIOIS/20HK4znZFUXnaY5cZohKX9xqHKkhJdTfBibEQmxRDatiJCDyy Y/jKu/ulroPs+7DXLu2geOUzw2EvBVZpDOKzONZ+LIZYna2Zyph8dgm8LKFaXY9HMf YkbFv5uWD6WYdRBsPT4AjEWfRKviI3c3leI3mQdw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paolo Abeni , Xin Long , Simon Horman , Tung Nguyen , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 079/301] tipc: fix a possible memleak in tipc_buf_append Date: Tue, 14 May 2024 12:15:50 +0200 Message-ID: <20240514101035.231664187@linuxfoundation.org> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514101032.219857983@linuxfoundation.org> References: <20240514101032.219857983@linuxfoundation.org> User-Agent: quilt/0.67 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: Xin Long [ Upstream commit 97bf6f81b29a8efaf5d0983251a7450e5794370d ] __skb_linearize() doesn't free the skb when it fails, so move '*buf = NULL' after __skb_linearize(), so that the skb can be freed on the err path. Fixes: b7df21cf1b79 ("tipc: skb_linearize the head skb when reassembling msgs") Reported-by: Paolo Abeni Signed-off-by: Xin Long Reviewed-by: Simon Horman Reviewed-by: Tung Nguyen Link: https://lore.kernel.org/r/90710748c29a1521efac4f75ea01b3b7e61414cf.1714485818.git.lucien.xin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/tipc/msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 5c9fd4791c4ba..c52ab423082cd 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c @@ -142,9 +142,9 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) if (fragid == FIRST_FRAGMENT) { if (unlikely(head)) goto err; - *buf = NULL; if (skb_has_frag_list(frag) && __skb_linearize(frag)) goto err; + *buf = NULL; frag = skb_unshare(frag, GFP_ATOMIC); if (unlikely(!frag)) goto err; -- 2.43.0