From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754890AbcAHMQj (ORCPT ); Fri, 8 Jan 2016 07:16:39 -0500 Received: from smtp-out6.electric.net ([192.162.217.192]:58699 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754505AbcAHMQg (ORCPT ); Fri, 8 Jan 2016 07:16:36 -0500 From: David Laight To: "'Konstantin Khlebnikov'" , "netdev@vger.kernel.org" , "David S. Miller" CC: "dev@openvswitch.org" , Thadeu Lima de Souza Cascardo , Eric Dumazet , Florian Westphal , "linux-kernel@vger.kernel.org" , Pravin Shelar , Cong Wang Subject: RE: [PATCH] net: preserve IP control block during GSO segmentation Thread-Topic: [PATCH] net: preserve IP control block during GSO segmentation Thread-Index: AQHRSgwjhecCnaY+Dk+2WzAvpw9VlJ7xhemw Date: Fri, 8 Jan 2016 12:13:49 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CCC01BA@AcuExch.aculab.com> References: <145225444176.22215.2003378381077166898.stgit@zurg> In-Reply-To: <145225444176.22215.2003378381077166898.stgit@zurg> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u08CGnuK017476 From: Of Konstantin Khlebnikov > Sent: 08 January 2016 12:01 > Skb_gso_segment() uses skb control block during segmentation. > This patch adds 32-bytes room for previous control block which > will be copied into all resulting segments. > > This patch fixes kernel crash during fragmenting forwarded packets. > Fragmentation requires valid IP CB in skb for clearing ip options. > Also patch removes custom save/restore in ovs code, now it's redundant. > ... > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > index 4355129fff91..9147f9f34cbe 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -3446,7 +3446,8 @@ struct skb_gso_cb { > int encap_level; > __u16 csum_start; > }; > -#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) > +#define SKB_SGO_CB_OFFSET 32 > +#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET)) You could set SKB_SGO_CB_OFFSET to sizeof ((skb)->cb) - sizeof (struct skb_gso_cb) so that the end of 'cb' is always used. (Assuming the former is a multiple of 4.) It might be worth using an on-stack structure passed through as a separate parameter - it doesn't look as though it has to be queued with the skb. (Clearly a bigger change.) David