Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1221168lqo; Fri, 17 May 2024 15:04:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2fgx2YHSXBOzP/IYGLEGI1x+u8xAAGdQxBq1fbf913Vb3lYfVOZooFD7J5dBlNeyN0gvWYvWyc3kw+4Dkvmv+Ak/NcHD/ZDU3nhVAYw== X-Google-Smtp-Source: AGHT+IHy2G1m7Xj1kMznhvYv0pTtkarUy/PlDFJ/8yajp7kIKNVy6Vn0jdW54854+qNq72H3Ckv5 X-Received: by 2002:a17:90b:b09:b0:2ba:e4d:d2b0 with SMTP id 98e67ed59e1d1-2ba0e4dd68dmr7554814a91.3.1715983476450; Fri, 17 May 2024 15:04:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715983476; cv=pass; d=google.com; s=arc-20160816; b=b+i/6pB2Ul80vwj1js3DaLt8GFFMom13JL8SfAx6OowWeQq7Lvfz2jzCWcBvoUCJRz gx0mfqRKRTZETBhjJUENadKp2X+6wmxom3Dy6CgXKULRwndZVrPeWOid0hVx/jyQjurW OvHxMh5a1y7Z8pGa0nJ+SCVr26chuzdJX/cmMKVf3SuL+rSOpouAMkCwu3uCr0Md2lVQ Zo46x8wgDT472kaMNKoJsD61gBhjKudd21BJuXvF3bKPDg4Uwsx5VWAyAtok1rnWY6+p 60wL+ZAxhV8UBa8cvd8RREOfocqSXJ+Y+5QNvEjCORELFyU/S895BeN4GrGuNZFAC/c+ ezwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=QNhyqbscLyY4X0wOzfIwCF0ZvOXVGW33QqeO11ZhdSQ=; fh=Hk1H47XKmmZ0wiR6crY0yXZF5/t1wemK9twhp0gMR+A=; b=Wdpew2sxCLpwSaoibbt7KWRFdAtE4PSwrnaXya+ucU8z9+rQpa4xKCvrt2gsM+KiTt KDFK1fduz3T9Bq4si7wqKBQRQHFDYBjX1q9UuX8a/jWZm+s606zU1ukIxuFv7t8BeicP 7kboxjqob/9iF3VueJ2e2thHmRh1UnwHTc0iNUkhc0Auznt+fMV1woTfJa7PCeeHltl5 Mcuk0LiLUYH9GrGslM0MYsWTZ8eZQnhigfO26XyJOHTxqucEZvw29IN347LNvOeT5WGy xrKvb20kL9PCdr7TqF2bX2zTuDbINnWNX0DToGCNSyCjuqdpFKwzQly4fUH255RQ47Dk lIXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n7Pd2o+f; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182665-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628ea7885si20621933a91.88.2024.05.17.15.04.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 15:04:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182665-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n7Pd2o+f; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182665-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182665-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 17F5EB23498 for ; Fri, 17 May 2024 22:04:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE1EE1420A8; Fri, 17 May 2024 22:04:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n7Pd2o+f" 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 CECC14C69; Fri, 17 May 2024 22:04:16 +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=1715983456; cv=none; b=SWiKPUk8gxxrxkgFuOs/isAchCinKm4KJPS40S5cbrgKj9au/hMlXbv9wB6mb9nqCdl+wnSmfoufqaIO6HAPLkkmO18F618UhlrlpiQQ72z1/7fodtdjUE3YsBlRL96IqYPqClH4PRf/WhG81vkwGkcbiZuTwkMQQzMIJI4gmBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715983456; c=relaxed/simple; bh=n8SD8ziMkDz3/npEj7IDyY34YAEf7wRETO/7yeEm57E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dR/nwopkpJcKvSDIdpV8wg/iejBWDcioQju+ZJRsNX9EXPPKsu7OK7R03PXZCfQMSNaZ3OxZiNMYvd6LDc3KKgdVsnTRgTBXkt5IP59yq33z0Zc2C5GLfaCBMtpKzOknh9H8VxL/xAkCJR9FXmXM8nKSiG7Pd9vQZamlHqTD6Q4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n7Pd2o+f; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5EB7C32782; Fri, 17 May 2024 22:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715983456; bh=n8SD8ziMkDz3/npEj7IDyY34YAEf7wRETO/7yeEm57E=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=n7Pd2o+fxgdGolgAPY0C+NmpYXAdsrEy2ftv8U7ZYJK6vURiSbZIXsJl5iWbTklOx zOVLwQv8aAnPSVNAZ87ia8ehiZt1M3XjW+aoAxFBMe68MCvO2MAspxR7CZbmKi7mkN 5uAV+iZxXmCYQlvgjTaWXmREAuRzCc0UZ6ClJHjCYOU3u1cit5EgbRA2I89D5Zl5QP ZVExYpDA96CEhp0+Sy8PabjMqHqZEHZCLSKpGoKx9abn/Zh0XslOJpGPCkpnE5EfJU ta8lr8W0RF4LtqfnDIcE633UxHrGt6y2PHzYmuEMMRkAAyyLSA7DhgKeyBYvANiTe5 xG6OMHh0QREAg== Message-ID: <5516f2af-cc92-408a-89ce-f571bcc998d6@kernel.org> Date: Fri, 17 May 2024 16:04:14 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [net] ipv6: sr: fix missing sk_buff release in seg6_input_core Content-Language: en-US To: Andrea Mayer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Lebrun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam References: <20240517164541.17733-1-andrea.mayer@uniroma2.it> From: David Ahern In-Reply-To: <20240517164541.17733-1-andrea.mayer@uniroma2.it> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/17/24 10:45 AM, 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 > --- > net/ipv6/seg6_iptunnel.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > Reviewed-by: David Ahern