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 527771C07C4; Tue, 15 Oct 2024 12:58:23 +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=1728997103; cv=none; b=LYYh2fba42Ir5eVeSsUM6QOFJzxdlSWbsrHlKMb9EARIJDw+i1kl4wAxk2qIR1gEgjaYSB3zYc8gTtvhtI0PczFsaoMyI6/xHzxzgaHvUTpPEUIGgVn1STqRXhPXwPP7uO+X1MiT1DszV5YwXRIzXKCiMTH+rlZ00f6Y6Vbc6MY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728997103; c=relaxed/simple; bh=CiNvrlmPyuR7oKc+ym1oJPUQLdti9kASxqKzLLDaEo8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LKERABZkmLNtW1REUIyOZMHl1W4uxPB0V6OSd3WaUXOjjFIQ77F50EPh9/vN0fanbYv/EV36rfdVRWn6LOleffuwPxfBOiDruiL/4Qz8KMnt457b8LC/h+EanttbAK2rOgqe4BuOdQ9yzp7N1ProM06DqSGxOJhtIQ06/aJ1hqY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lvJyI3it; 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="lvJyI3it" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC607C4CEC6; Tue, 15 Oct 2024 12:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728997103; bh=CiNvrlmPyuR7oKc+ym1oJPUQLdti9kASxqKzLLDaEo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lvJyI3itnnRtTktyRHV1G+50sZYYOfKDYYJdzRoagY3QhWVvGle0rz+7lvKB2sBWP LI41hMEiBicUTbDE9wrIzgajWyiXkcPe4+IXYJKP0lk01Da1VzBz49lOcIoNQ9olNc 2wYVL9w1o0OK0+T5zOv+u0Hr5NJisMR1Juo+4fqA= 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 5.10 088/518] net: ipv6: rpl_iptunnel: Fix memory leak in rpl_input Date: Tue, 15 Oct 2024 14:39:52 +0200 Message-ID: <20241015123920.400047811@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015123916.821186887@linuxfoundation.org> References: <20241015123916.821186887@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 5.10-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 2ba605db69769..274593b7c6107 100644 --- a/net/ipv6/rpl_iptunnel.c +++ b/net/ipv6/rpl_iptunnel.c @@ -268,10 +268,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); @@ -292,9 +290,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