[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f91c3fd7-8d7a-7a91-8d16-935c90ef9b5d@huawei.com>
Date: Tue, 1 Aug 2023 14:28:21 +0800
From: YueHaibing <yuehaibing@...wei.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <davem@...emloft.net>, <dsahern@...nel.org>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <yoshfuji@...ux-ipv6.org>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<simon.horman@...igine.com>
Subject: Re: [PATCH v2] ip6mr: Fix skb_under_panic in ip6mr_cache_report()
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.
>
Powered by blists - more mailing lists