Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2109120rdb; Sun, 3 Dec 2023 03:03:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEB9UowA2lN0ExrutBcCZMD+ufIwzUSkmvE19S2SwSHf/845uKEUuYk8jB/VaoAqAQXc6yc X-Received: by 2002:a05:6e02:348b:b0:35d:59a2:68f7 with SMTP id bp11-20020a056e02348b00b0035d59a268f7mr4136184ilb.36.1701601415026; Sun, 03 Dec 2023 03:03:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701601414; cv=none; d=google.com; s=arc-20160816; b=qoYqyA6knEL+ihOPIustrsyqs75FbwBlV3Udt6U88nyy7msMKXPywP2Zwk6h8a/zEE UjAo1eFSYyVbe1FB+1kkrSYzXecUKhI85IptDsJB3waCzngeuDrwyx5teohRfewRSE86 BKhGpA3Icf/JYR04Cw8qS1JVSfv7XcF+Ncu3kyb5X3ZRL3mbmAukYU0fqXVMAb/aXMgj YCKEZUfeVcOGx8wlzPu1JvAG2B/C8je6eNraXcS86cBAJXhueMCoCUvByfJep20bA5ah 9z/aKH3lsKCscPZKcQHfBnqxL8jvGO5RYGABzI1xBSAH0G9cofNbJ3VgjKbV//0Xqni0 bB6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=WCN0TPEmvd7kz6bn2yXvkGu2UfPcBGCxL6UVnP3vpy8=; fh=mXT2XNK0xgtOR3Iwf6P3Phf60u6jtxy5mD+Y4OOxRBM=; b=JFnQcMMD1XYPL5KECgJiRwpnChmZPE9YUk5Lm4Fnl6+DpiwexxVNAqZCF7x7hrDLqE gfxFfIOFwIMSLsZ0elc0KGkyHTXaU8oRRcxUTtmro/gwQ0IQoGRCWS3PAck+KR1l8kp1 EpNC+sVvY4d251MZMKRe4PeRV7rYuvsTRJw55q2y3vyQyaj2XhfZ4wDpNSJSg0aIyGjZ XvMoDIrN9UANDTKVzz8WmC0NZvEJ20bWBPq/zKoNwU6fV7JFUCk/eoOSlZGYpkbgb/V7 vWTHLpRHfefewJLEPU5DvuO4CQi+LZt+0oRRDXbt01QAXU8iWNrV6G6X/NuWNPfjOo1U NcVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=o9cUoLd7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d7-20020a170902728700b001cc3397aa27si4349037pll.62.2023.12.03.03.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:03:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=o9cUoLd7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DB3C980697F0; Sun, 3 Dec 2023 03:03:32 -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 S229995AbjLCLDS (ORCPT + 99 others); Sun, 3 Dec 2023 06:03:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjLCLDR (ORCPT ); Sun, 3 Dec 2023 06:03:17 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD7FA2 for ; Sun, 3 Dec 2023 03:03:23 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40b367a0a12so34725e9.1 for ; Sun, 03 Dec 2023 03:03:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701601402; x=1702206202; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WCN0TPEmvd7kz6bn2yXvkGu2UfPcBGCxL6UVnP3vpy8=; b=o9cUoLd7MO5O5rbJ9tUNfdXVMWL3FZWkNZVsp6WhPX85pcCMMTFBLhWPNzUl9gumDl pCxLK9xZAHgkEDfgnQg2z08jUlc/XBCy1d4U4u5cpjSa+3daEEZAaGCdb7ZPJc41dpX4 EhrfGaAKAnaE0uiEg/LZnGVng12WB9fc5scWIiNbwXgETSVJgX0qUK18Rc8hdLeUl/hF 0BrlriZQ5Znuh2KBUCZ+f/SC8AvYVfQ8ECfL47/LimF70OcWniahiOKzbr3QtRk7mvzh cRinldanYOIinS7ii9KKwaTmvZc0d0kSyK5oIxGS07h4/RqShhNMehI+Fhime+osFhms mawQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701601402; x=1702206202; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WCN0TPEmvd7kz6bn2yXvkGu2UfPcBGCxL6UVnP3vpy8=; b=nEGbDflS3aNfaJ5LxWnKXPH99ufH6E1YM4mK0ChyHuegm2hRJilBGsgmi5W2jqf6GH r+QaGS6h6UK2HWHcLIvnkBf3T2AhAeSN6L8iHSCijjVfbJrPK/YK9MhKHLYro2wDlm4s YsXMVhcsHfjQOwtV4lOZJzr/AWrVcO5qcW6ef2bPcOHpnOH/mnIgg8c8iWSucW7a9R6t 2Y12eHYaGQf6l+FJU5qr0n5NbmppasNFpGC+w0WX8baK5l73OJ6riVKsFiDydtguoJou YQpIlLbRSKBcZ7l7ScvdhUXqAv5179WQrqjs5jAuhp294QHlliZlO3Mhsn+meP/UV1QC Z24g== X-Gm-Message-State: AOJu0Yw8pv74cnVlsA8MH9iEZFuqK4q40Tr/eoW6UZpZN/xEnj7FNnfr Wen4vlUnEn2+AuTJh15e6avbdyOsxkuldNl7bqOYXw== X-Received: by 2002:a05:600c:54e7:b0:3f7:3e85:36a with SMTP id jb7-20020a05600c54e700b003f73e85036amr301125wmb.7.1701601401537; Sun, 03 Dec 2023 03:03:21 -0800 (PST) MIME-Version: 1.0 References: <20231202161441.221135-1-syoshida@redhat.com> In-Reply-To: From: Eric Dumazet Date: Sun, 3 Dec 2023 12:03:07 +0100 Message-ID: Subject: Re: [EXT] [PATCH net v2] ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit() To: Suman Ghosh Cc: Shigeru Yoshida , "davem@davemloft.net" , "dsahern@kernel.org" , "kuba@kernel.org" , "pabeni@redhat.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable 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:03:33 -0800 (PST) On Sun, Dec 3, 2023 at 7:58=E2=80=AFAM Suman Ghosh wro= te: > > 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 =3D tunnel->hlen + sizeof(struct iphdr); > >+ > > if (skb_cow_head(skb, 0)) > > goto free_skb; > > > > tnl_params =3D (const struct iphdr *)skb->data; > > > >- /* Pull skb since ip_tunnel_xmit() needs skb->data pointi= ng > >- * 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? Adding unlikely() is not needed, it is already done generically from the inline helpers. Reviewed-by: Eric Dumazet