Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1154982lqo; Fri, 17 May 2024 12:24:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVeXnNTZ+MhEufQJdz/oFdSNEKar9mKAlvzHglFNaF80NB1oiVIY35sLVek5i+ci5alMnfRDS5T2IlSe1g73aGAH5hqZ05B256zhLEgLw== X-Google-Smtp-Source: AGHT+IGOs6ZHCtOmxAX6Zj5RHc2UIqpHhYmVN3aPRv71JFhTG+/nvMLY0hgDEC6nidppy4FZocgQ X-Received: by 2002:a17:906:130f:b0:a5a:51dc:d1a with SMTP id a640c23a62f3a-a5a51dc13bdmr1220888766b.3.1715973850465; Fri, 17 May 2024 12:24:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715973850; cv=pass; d=google.com; s=arc-20160816; b=AXm94oNaA8l0jIs6JMwTspvB2/VTuYOeTaQr01jpIaffsXxKpo4GN6G7Gm72rTsXGa 9bK0ATIKqs9fH+CNywK4qH2gJ/ENSqJ17b+T7v7JGvdisy7vsDeH55zqHbIRNtUp6txo 5kYa9jhyM2ZD8XIkGBBrzDbTPKiBhDbWYRp6A8ohO6W8T3sUphQOWp6aOJqQFINe/7/r fxvZC6GyhJSs0Hgr7o2EQP07VQFOD2nPl7oJrXpshczbnqY9gS0oRsJHdgG+WqZu+g6C gT1/4EOtht+pc/7Ompok6/5whWGtZwr2mIdt3gxnu7F8TgcnlbTSJ53ZiB88pgXM2JYQ 0h3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xBf11z02EtWhrl+U8mqTsK+76hAquuvZL/yXRsOUk6g=; fh=3RqweXnpYMxl3g3GuAnDm6xyMLGmDWpOmrVHGt1VGY8=; b=X5SNrLVRQvSVIGafSdImrAypWxbsVa6ReCVa8PhHB36MXOz7zrtMrMnPtyeJElIKo1 h+Ohe6anknb4A7KrB3Ytb00IjjsW9lsmaMEtTpolkt91fW1InWTOF4R/XKjqcLpQZXPc LFymcHP+AXmCPxa26pbNywfy9X0EgUq3RJOTR3UQu9gPxjyjQnsZqfuNyMNVAK26NoQZ Ik5kEV9gNa7GAfvltX64xsrtBl8wjwm8Yj2y9ltKWAOr1PcOlxTm8inaBdT0u9DUq7TX 28DIcXsPAHWD99z2NVFVNZhKgx2Ym+nCT56x8zWRM/4lI/wS+zK2giW1Cy+rF7vx4CgG 4Iag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=on9tiZWH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17945e81si1029638666b.91.2024.05.17.12.24.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 12:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=on9tiZWH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 344651F238E6 for ; Fri, 17 May 2024 19:24:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4946140368; Fri, 17 May 2024 19:24:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="on9tiZWH" 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 EA4A413FD83; Fri, 17 May 2024 19:23:59 +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=1715973840; cv=none; b=s0U4paFSgtFiwMdvWanWR/pNzJSDxuNkiFmMTAcVglgsPZHqqtI+LxBYC6aQTBYIiWe6QcIoMagaTJTwVD80B3LvI/fts2TKTu4LFDKE1LUBExlOidcYfM6NDDBkJk1pm/boHvXE8q0BOZa8txpWt3ke5qqKbfFVhQgYaUud56Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715973840; c=relaxed/simple; bh=+YaIyH/rzSTxIu7TV2GIrivyhTVp89FNH+Tksr+GA38=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TC5HHWbHvbABalZx5qZ4GKPkMk/GpUkIsB6oC/1vFQyvwoe6aBv0/QiDlwB9B+5w7lcr205f/WJeEAvO8kyuDDMg0K+MJV0dwTxllWvxrbjjYv9uzB2sk9HShJ0VEzS+L7eWnqQVb8Kaldcu4fdA3XxY3n3iRYVniwud4oYYKLw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=on9tiZWH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B37C2BD10; Fri, 17 May 2024 19:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715973839; bh=+YaIyH/rzSTxIu7TV2GIrivyhTVp89FNH+Tksr+GA38=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=on9tiZWHjsFwno2GElOcLOmnbPZjEa2QPlpGYug07Akpm2k+zYnYUMAlb2CiOl1ui EMkB3Lxy1E4AAV0vtd6tjHIW+hCs2RqUQykEocqVnCOIlaKRNmKSc6I4bu8C/DH1V4 oht1jEeHKC9LI6Pm5VRuVltcj5nzCHqi/bF6Lchewi574vE1t0u8hLiZjfn+VQRUXZ GWWHKwBRZsYxVTMDRSw4v5CJ39fi84bhVrRp4ZVlrjdURwCzY2zHhxHqo5Z43O8PIA 2Rhs/ThkWG0SMAJKEMLhcfdWwttlUeZg2JSG+us4C+XbxLGGrYx7mvqVVLw8kihTqw OrHOG72v5eU5w== Date: Fri, 17 May 2024 20:23:54 +0100 From: Simon Horman To: Andrea Mayer Cc: "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Lebrun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam Subject: Re: [net] ipv6: sr: fix missing sk_buff release in seg6_input_core Message-ID: <20240517192354.GB475595@kernel.org> References: <20240517164541.17733-1-andrea.mayer@uniroma2.it> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240517164541.17733-1-andrea.mayer@uniroma2.it> On Fri, May 17, 2024 at 06:45:41PM +0200, Andrea Mayer wrote: > The seg6_input() function is responsible for adding the SRH into a > packet, delegating the operation to the seg6_input_core(). This function > uses the skb_cow_head() to ensure that there is sufficient headroom in > the sk_buff for accommodating the link-layer header. > In the event that the skb_cow_header() function fails, the > seg6_input_core() catches the error but it does not release the sk_buff, > which will result in a memory leak. > > This issue was introduced in commit af3b5158b89d ("ipv6: sr: fix BUG due > to headroom too small after SRH push") and persists even after commit > 7a3f5b0de364 ("netfilter: add netfilter hooks to SRv6 data plane"), > where the entire seg6_input() code was refactored to deal with netfilter > hooks. > > The proposed patch addresses the identified memory leak by requiring the > seg6_input_core() function to release the sk_buff in the event that > skb_cow_head() fails. > > Fixes: af3b5158b89d ("ipv6: sr: fix BUG due to headroom too small after SRH push") > Signed-off-by: Andrea Mayer Reviewed-by: Simon Horman