Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2125764rdb; Sun, 3 Dec 2023 03:54:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3snJuLyOskex2g/YMcnge6N/c/HNYwaux2BPpgughkMV58kF1aNrhtj2rC1uqL9z5z9if X-Received: by 2002:a17:902:e88c:b0:1d0:6ffd:9e15 with SMTP id w12-20020a170902e88c00b001d06ffd9e15mr3077131plg.103.1701604487529; Sun, 03 Dec 2023 03:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701604487; cv=none; d=google.com; s=arc-20160816; b=YlzY89bK1sOZWKWxuYCLuiYE5KH2WXKBcBRmcTv+L4QgB4UidfkMlzIai3EHbEe9mO bRfbsusHzlpCILP7vaPhH0idqttBTE2Mz4X4Sm1JAzaei2X7bwuVr4W/AJbYN3nTZuF4 Nbme/6N9/gV1+kFQhrSGVjTvzbrl9h3P73t1w+bh77ly35DYQr9c1Na/cgN+MZ27cuN9 si2pM8WLtkciwJ5uX/G4kZUt13L500tvk9FyeB1JGcYXLbxwdP6VZcjvEr5VSxYaJP9n iMBoC11NPml8+AFaA13vY7C5mLr8mr96sYRXPJER5on3GapoG+QNdCRw45bKcb6HCdiJ QeMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :dkim-signature; bh=NsMMCvKq0Ewiy320Ly77st5H5qzHH4bDYVOsTjx5q7g=; fh=coYVjsi7sWj4Yqsnelv4tZjgkxUwLILYGH0T4Z6lM6E=; b=w5KH6xDNeuvvJuX/6w+E9jCrJItd4nPkcysSZD7rx7IttzBTDVHXhwElq3/nAtz3ii FV8o0IDM1Od+P4LJRxdq0tOqwBtqZ35iQXCKWe9G0E6Vp1PVAsQLrh5zd9HeDBt32kBX FV6Fq2vTFPRrYDTE0dTYYi+1lmPGQpYWzINXS463J8aR3lq9AF5jfd7XFJgXtErxCR6/ mHNz2I7AD2zbKNuOHMmI8OFtvxbet/24zz6YKqd64FrW4bX1IaewN1Z/9fQnyAsaCZ2O xVTHOsB/DXqodW0qxY3ThS+JtPRvT+nJuEIk+9Mc38TpIVU/0XJvSmaRhRfnrhHsgy/L P9qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iMIZzSnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id jj19-20020a170903049300b001d03e682de7si1183312plb.159.2023.12.03.03.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:54:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iMIZzSnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 36A5D8069D85; Sun, 3 Dec 2023 03:54:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233386AbjLCLyd (ORCPT + 99 others); Sun, 3 Dec 2023 06:54:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjLCLyb (ORCPT ); Sun, 3 Dec 2023 06:54:31 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D322BD for ; Sun, 3 Dec 2023 03:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701604477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NsMMCvKq0Ewiy320Ly77st5H5qzHH4bDYVOsTjx5q7g=; b=iMIZzSnpWDjmrB1ZYgrjowyrb8jtStYoU144SlKeZ0/HkKD32anqVzJ+VOdEHupMmozEKi GXSnc8Tv2FaWnmEpDFYRgCxRk4FXFUDBsTyzdg8JngW/GV4LzwH2PwNCqTVUhRJYhYPntT 2U7vIjldKSiEhoSFRxdV5kManaHU0no= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-197-eEVrfJxlOzK7ZjfpVF38DA-1; Sun, 03 Dec 2023 06:54:35 -0500 X-MC-Unique: eEVrfJxlOzK7ZjfpVF38DA-1 Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-5c65e666609so1298107a12.1 for ; Sun, 03 Dec 2023 03:54:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701604474; x=1702209274; h=content-transfer-encoding:mime-version:references:in-reply-to:from :subject:cc:to:message-id:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=NsMMCvKq0Ewiy320Ly77st5H5qzHH4bDYVOsTjx5q7g=; b=g5+r/ldyIR0cXDwe/6P4aToDgoie/1lMwAd+f/zEoPQUg7bTgummtO+1ksY8f+CNBQ FW6lwqZq+kJzkN5cqMZldGPDKGeuohas0ZxXhGl39jaWCmYERr+OB/Gd5Hg9c8hPKrZ5 iZoa+7IKExBulbq5LhDrLfMHmZ3w7iIxfjt+Za4P3+EvR392P671dQ6S/lBhAQw9Ezy5 LFK74qDFZHdv0XQiXcv6tHjXPygg75QpMfQDnrSMTXpmwvYU2N0KvR1+JJWSuOpw0wng R43uZaRzbHkR0lNFwdsCDiPwilbkdi5qVQJoAndYbX3hGYMXB8nzOlDB8urqU/g/kST0 pBJA== X-Gm-Message-State: AOJu0YxHqgG1dO/uQl1x2TRVEz/legKjXFHBGe3NLqi47sETzFU4EhQ6 uJEYqMTpWK1poD+atRkFJKWAV4pRSJAY0D2kj5FcHqFCjsAeP4fxPCToHe4i9d1rCI1UrMag9Ib r5B/sGd4O08IXvy6sekl4tcmY X-Received: by 2002:a05:6a20:7f8f:b0:18b:5b7e:6b9 with SMTP id d15-20020a056a207f8f00b0018b5b7e06b9mr3587797pzj.2.1701604474349; Sun, 03 Dec 2023 03:54:34 -0800 (PST) X-Received: by 2002:a05:6a20:7f8f:b0:18b:5b7e:6b9 with SMTP id d15-20020a056a207f8f00b0018b5b7e06b9mr3587789pzj.2.1701604474077; Sun, 03 Dec 2023 03:54:34 -0800 (PST) Received: from localhost ([240d:1a:c0d:9f00:7d6c:1284:4ab0:52ee]) by smtp.gmail.com with ESMTPSA id x188-20020a6263c5000000b006c31c0dfb69sm6132152pfb.188.2023.12.03.03.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:54:33 -0800 (PST) Date: Sun, 03 Dec 2023 20:54:09 +0900 (JST) Message-Id: <20231203.205409.646024453190363727.syoshida@redhat.com> To: sumang@marvell.com Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [EXT] [PATCH net v2] ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit() From: Shigeru Yoshida In-Reply-To: References: <20231202161441.221135-1-syoshida@redhat.com> X-Mailer: Mew version 6.9 on Emacs 29.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 03 Dec 2023 03:54:45 -0800 (PST) Hi Suman, On Sun, 3 Dec 2023 06:58:19 +0000, Suman Ghosh wrote: > Hi Shigeru, > >>diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index >>22a26d1d29a0..5169c3c72cff 100644 >>--- a/net/ipv4/ip_gre.c >>+++ b/net/ipv4/ip_gre.c >>@@ -635,15 +635,18 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, >> } >> >> if (dev->header_ops) { >>+ int pull_len = tunnel->hlen + sizeof(struct iphdr); >>+ >> if (skb_cow_head(skb, 0)) >> goto free_skb; >> >> tnl_params = (const struct iphdr *)skb->data; >> >>- /* Pull skb since ip_tunnel_xmit() needs skb->data pointing >>- * to gre header. >>- */ >>- skb_pull(skb, tunnel->hlen + sizeof(struct iphdr)); >>+ if (!pskb_network_may_pull(skb, pull_len)) > [Suman] Since this is transmit path, should we add unlikely() here? Thanks for your comment. I traced this function and found that pskb_may_pull_reason() seems to have appropriate likely() and unlikely() as Eric says. I'm new to Linux networking. Could you kindly explain the background of your suggestion? I understand that a transmit path must be as fast as possible, so we should use unlikely() for rare cases such like this error path. Am I correct? Thanks, Shigeru >>+ goto free_skb; >>+ >>+ /* ip_tunnel_xmit() needs skb->data pointing to gre header. */ >>+ skb_pull(skb, pull_len); >> skb_reset_mac_header(skb); >> >> if (skb->ip_summed == CHECKSUM_PARTIAL && >>-- >>2.41.0 >> >