Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5207344rwb; Mon, 31 Jul 2023 21:13:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlGQPWw7DCtOs9FqbDVzOKp3bgDUDeA0FsNpgCzQmpWIeBqA/loIgjPqxzlqLf6B42kJKk7Y X-Received: by 2002:a17:902:c20d:b0:1b5:edd:e3c7 with SMTP id 13-20020a170902c20d00b001b50edde3c7mr10888257pll.16.1690863239240; Mon, 31 Jul 2023 21:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690863239; cv=none; d=google.com; s=arc-20160816; b=AiANvWUhZacAdQbFwXnRpIK49Nc7Ag5OxWkjuk1D7zl/dQtwDQmVUTh5L8Yu0Uw3QJ tO4d0CDOlGYVeh3etXEic1y9LgYYbdFPvfGV5p8ZvDZ/bWGBOfuz5tt05gyyWuZfgDE+ 7IopddbAmklBtbTqljpl5axNV+JlTuMPwImh5kohsFE/ckJXBsUTxuTmMru4nF7ezznV yFVuFP6hhKh9w7ccMwld5O5VnhPR+Xc99+1KFFuwZMuansu1CoEFBwsCuJgWYJqxNHFw UmHcwshH7O1/k3ih/6zMykyCHa2lhclYLfBAB3ia4SuH1fU4DCY8KXLBL0CbhHC/SA3x 7l8Q== 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:message-id:subject:cc:to:from:date :dkim-signature; bh=oOXp4msadUmPjPRfvuisGnivpWPHtZmM5iDCXjKFLjI=; fh=e5BLqgXJOSgzY0SFkTt+azkZzbZw7HamgIGEVKMkyjs=; b=0RzqbYCyJ8Pinn9g5YbXe7NEZ1VMzHRYN8b0Enpd3m0dw52x756wuIMZiCHvXfAcnr gnoRMhmw1qVPd/gn0KLoTpAjzk2/i73fjG66LPLlQusQmrj+uFp8MB//IpgVSxPdTV9q OqH0MJGb0fTQKtjbv29D3zfBRCx/OJEk8WJWgtapavWvcuQdUf/thRmDuJrFFUFitwWT KoFPILFpy5H4bj/8MfocPwkAj0+SmvSxsafWJVuJTzaNZ0Q/X+Ow1qkezemmGAdh0leX YgN7f941LdJuv6PkpC+CS8U0mFKLDMD0oPCU+PrVok3kUZ1qhY70PPfRcNRF9zj0A/Ov cTaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iIfIeVSu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je19-20020a170903265300b001bb9d64f01fsi8180237plb.85.2023.07.31.21.13.44; Mon, 31 Jul 2023 21:13:59 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iIfIeVSu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231761AbjHADKE (ORCPT + 99 others); Mon, 31 Jul 2023 23:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbjHADKC (ORCPT ); Mon, 31 Jul 2023 23:10:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686C919B0 for ; Mon, 31 Jul 2023 20:10:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E8410612D8 for ; Tue, 1 Aug 2023 03:10:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E40A1C433C8; Tue, 1 Aug 2023 03:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690859400; bh=X6Z9QOKzikJGxKFX2tBf3wIQdI88JGKWEXi24Ybq4MA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iIfIeVSu/c4UcRznqKtcdxa18wlnj6ChVSHG7EctmvUsjFt5BapHNNtlwbkJMhOfi idGdgH3pQzvmNXj7OI9N9IWV8kI1hur293KpzgusRRmQ08/0nsVuHciWtiIPdUKwNI +SKstyRjcz6u6KKccx3JDeD/FdwgkvcrX7qnj89BqtETiNd5ojEXD8Y8VEY4reu64B enGGr8yrpHakvkmIrapnuPG2KAYSrOB+XnBCBuVadIIVvP0RddBYDKdjJxj7iP7K5h yjRjLmYzhAGFHk4YbcdYWREx+KXVt9c9RN7Phj/XTW9qIWUrrE7eZG/61ZSpxT0Xbj oAZcdQLNpr8fA== Date: Mon, 31 Jul 2023 20:09:59 -0700 From: Jakub Kicinski To: Yue Haibing Cc: , , , , , , , Subject: Re: [PATCH v2] ip6mr: Fix skb_under_panic in ip6mr_cache_report() Message-ID: <20230731200959.2019cb9c@kernel.org> In-Reply-To: <20230728121703.29572-1-yuehaibing@huawei.com> References: <20230728121703.29572-1-yuehaibing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 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)); -- pw-bot: cr