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 617441D0429; Wed, 2 Oct 2024 13:24:40 +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=1727875480; cv=none; b=UKclSEvaENeiklUs9pZsiva1YmXd4likQfDge9ANxarWrfIo18lswjys/J0Rv9Q0RRwa3Bb6TGJyu5ddH22b073AshAIQ/HJpHgobz/22D7Q92qmtJs1uIbphuv4HuYkL6rkLECC5gdisDAtlQWyXc24DPlemzHXZQA5NnmR+14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727875480; c=relaxed/simple; bh=3P81uuSDflzZJ3c7hT6UKm37ic7IoU+N1zxxLyCTw7Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZjiezGvU11sqdxirTFcvvx+qDa7il9V/Kzpf0MbKLBeNdlbMVrxOyx/66GjKYVwgIgsRwoDhx2SalrEmzYvN9xil3YvgV5Oxo+YU2FArvBHQSqm6rilHWnA9/GZd5T0ZL1s6fpXRPtpeya2Z7imxmB6njgHManOR8UU7WcizAjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dmqH4zL6; 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="dmqH4zL6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D29A6C4CECE; Wed, 2 Oct 2024 13:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1727875480; bh=3P81uuSDflzZJ3c7hT6UKm37ic7IoU+N1zxxLyCTw7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmqH4zL6drJSqczEFFh3vmSQPAXrUWYAoY7OVeIgRREhSZrPtu6FYp3kyeC7AaNHd 8Km8qBhPbSXnkAvezeTBd1yDF2uv+Qq/d6bMPr2qslEwVD0ODuuydsqGoEYJcQGCeb zTIUOO0nAJeNEECsUsI+l11NpOQsgQFV0Zbshmeo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Justin Iurman , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.11 114/695] net: ipv6: rpl_iptunnel: Fix memory leak in rpl_input Date: Wed, 2 Oct 2024 14:51:52 +0200 Message-ID: <20241002125827.023234374@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241002125822.467776898@linuxfoundation.org> References: <20241002125822.467776898@linuxfoundation.org> User-Agent: quilt/0.67 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.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Justin Iurman [ Upstream commit 2c84b0aa28b9e73e8c4b4ce038269469434ae372 ] Free the skb before returning from rpl_input when skb_cow_head() fails. Use a "drop" label and goto instructions. Fixes: a7a29f9c361f ("net: ipv6: add rpl sr tunnel") Signed-off-by: Justin Iurman Reviewed-by: Simon Horman Link: https://patch.msgid.link/20240911174557.11536-1-justin.iurman@uliege.be Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/rpl_iptunnel.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/net/ipv6/rpl_iptunnel.c b/net/ipv6/rpl_iptunnel.c index 2c83b7586422d..db3c19a42e1ca 100644 --- a/net/ipv6/rpl_iptunnel.c +++ b/net/ipv6/rpl_iptunnel.c @@ -263,10 +263,8 @@ static int rpl_input(struct sk_buff *skb) rlwt = rpl_lwt_lwtunnel(orig_dst->lwtstate); err = rpl_do_srh(skb, rlwt); - if (unlikely(err)) { - kfree_skb(skb); - return err; - } + if (unlikely(err)) + goto drop; local_bh_disable(); dst = dst_cache_get(&rlwt->cache); @@ -286,9 +284,13 @@ static int rpl_input(struct sk_buff *skb) err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev)); if (unlikely(err)) - return err; + goto drop; return dst_input(skb); + +drop: + kfree_skb(skb); + return err; } static int nla_put_rpl_srh(struct sk_buff *skb, int attrtype, -- 2.43.0