Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5301008rwb; Mon, 31 Jul 2023 23:33:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlEBJMYoM3lNJpz6xagndgTlQab1HXsPstGpo7uue3eV55CLfp3k9MtsEbJ6Pl6g+itnraR8 X-Received: by 2002:a17:906:109e:b0:99b:cf7a:c8d4 with SMTP id u30-20020a170906109e00b0099bcf7ac8d4mr1717029eju.18.1690871612209; Mon, 31 Jul 2023 23:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690871612; cv=none; d=google.com; s=arc-20160816; b=x31iPVMnY0KVxq3MHbPJL6dSoCfw25nKgO66AEfdBY8bkFKlYj1koa56jv5ENFilfl 5AjU4zpqBKsc4XsoURwlizEvzL6wc9WLLve+DuuGlkV3tQNE6LXTKeGJeUQ6TplArCdG DtknZpKGg88/v9f0cCCDlAn8CL0WpbrRJFHJSNx8o0AYpvwsUXpGatJ5sRz5E//ooB6c IR8IzeRO8t3edCPuW+BmB4gwED1DySbbIpWE1SlLcM0DphJmfOOcqdeeKN+ptltoCyMw JAP9gKw9jymic8K0m2p8ClPIPiknG1C4TzFNZd6+urHherEoii+R/eyJdK4VJI5RHauT k8ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=m5FEPTT7qpiDmZ6c/YalaoBaJOKlI8HTNcAVX9pujBc=; fh=HStvxLH0tTMSd7N6IS6JTy/CA7xja2CoxVPTidmAL2g=; b=htK+uxiv0/2HYubWygRpW73peBxpjwg6Wo3Qf4rSk5gXrbe3gORqVwHxuyyB5cmw/4 RknX25TUsMEdVUidToVr2Pg5BLZhcg55KbWQVan+gxuzPdRoBYA5lxhx2E5OevD0Cv1X Ii/XPzNWzc7vCP9o32hrBLVrbdWv4BlelKydJ/9aLNsQw+js6uCxaXPYJqXGSMBlvHMu cAmg5/xToFzzCQ+EJ7KQI+TU//4g3wEDaFR5hKWBtGfCINu4XcIkJOX69J+CZfeCXNgH MD+Nm4NUn/2E0WF3KllZrb7zYSUeTyKXjtBDVhVbXwd7n6HFziar+fkJ51w4OsqDZUVG LiXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ja1-20020a170907988100b00992b4abde3csi8540623ejc.916.2023.07.31.23.33.07; Mon, 31 Jul 2023 23:33:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbjHAG3D (ORCPT + 99 others); Tue, 1 Aug 2023 02:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbjHAG3B (ORCPT ); Tue, 1 Aug 2023 02:29:01 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E269F19AA; Mon, 31 Jul 2023 23:28:32 -0700 (PDT) Received: from canpemm500007.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RFQ9r2JMzzVjrq; Tue, 1 Aug 2023 14:26:40 +0800 (CST) Received: from [10.174.179.215] (10.174.179.215) by canpemm500007.china.huawei.com (7.192.104.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 1 Aug 2023 14:28:22 +0800 Subject: Re: [PATCH v2] ip6mr: Fix skb_under_panic in ip6mr_cache_report() To: Jakub Kicinski CC: , , , , , , , References: <20230728121703.29572-1-yuehaibing@huawei.com> <20230731200959.2019cb9c@kernel.org> From: YueHaibing Message-ID: Date: Tue, 1 Aug 2023 14:28:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20230731200959.2019cb9c@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500007.china.huawei.com (7.192.104.62) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/8/1 11:09, Jakub Kicinski wrote: > On Fri, 28 Jul 2023 20:17:03 +0800 Yue Haibing wrote: >> #ifdef CONFIG_IPV6_PIMSM_V2 >> + int nhoff = skb_network_offset(pkt); >> if (assert == MRT6MSG_WHOLEPKT || assert == MRT6MSG_WRMIFWHOLE) >> - skb = skb_realloc_headroom(pkt, -skb_network_offset(pkt) >> - +sizeof(*msg)); >> + skb = skb_realloc_headroom(pkt, -nhoff + sizeof(*msg)); > > These changes look unnecessary. You can leave this code be (as ugly as > it is)... > >> else >> #endif >> skb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(*msg), GFP_ATOMIC); >> @@ -1073,7 +1073,7 @@ static int ip6mr_cache_report(const struct mr_table *mrt, struct sk_buff *pkt, >> And all this only to mangle msg->im6_msgtype and >> to set msg->im6_mbz to "mbz" :-) >> */ >> - skb_push(skb, -skb_network_offset(pkt)); >> + __skb_pull(skb, nhoff); > > .. and just replace the push here with: > > __skb_pull(skb, skb_network_offset(pkt)); Thanks, will do this in v3. >