From patchwork Sun Mar 29 02:07:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 25266 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id BE66CDDDF6 for ; Sun, 29 Mar 2009 13:08:16 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755094AbZC2CHR (ORCPT ); Sat, 28 Mar 2009 22:07:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757899AbZC2CHQ (ORCPT ); Sat, 28 Mar 2009 22:07:16 -0400 Received: from rhun.apana.org.au ([64.62.148.172]:48977 "EHLO arnor.apana.org.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756831AbZC2CHO (ORCPT ); Sat, 28 Mar 2009 22:07:14 -0400 Received: from gondolin.me.apana.org.au ([192.168.0.6]) by arnor.apana.org.au with esmtp (Exim 4.63 #1 (Debian)) id 1LnkQT-0000K1-6m; Sun, 29 Mar 2009 13:07:05 +1100 Received: from herbert by gondolin.me.apana.org.au with local (Exim 4.69) (envelope-from ) id 1LnkQP-0002bm-UC; Sun, 29 Mar 2009 10:07:01 +0800 Date: Sun, 29 Mar 2009 10:07:01 +0800 From: Herbert Xu To: James Huang , "David S. Miller" Cc: netdev@vger.kernel.org Subject: Re: skb_segment() questions Message-ID: <20090329020701.GA9983@gondor.apana.org.au> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Mar 04, 2009 at 07:12:40PM -0800, James Huang wrote: > > (2) What is the purpose of the this check? > > ` if (pos >= offset + len) > continue; > > If the payload in the head buffer of skb has at least mss bytes, this > check will succeed and no payload in skb’s head buffer will be copy into > nskb > through a call to skb_copy_from_linear_data_offset(). Something seems to be > wrong here. Indeed. This breaks linear packets, which unfortunately older versions of tun likes to construct. gso: Fix support for linear packets When GRO/frag_list support was added to GSO, I made an error which broke the support for segmenting linear GSO packets (GSO packets are normally non-linear in the payload). These days most of these packets are constructed by the tun driver, which prefers to allocate linear memory if possible. This is fixed in the latest kernel, but for 2.6.29 and earlier it is still the norm. Therefore this bug causes failures with GSO when used with tun in 2.6.29. Reported-by: James Huang Signed-off-by: Herbert Xu Thanks, diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 6acbf9e..ce6356c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2579,7 +2579,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features) skb_network_header_len(skb)); skb_copy_from_linear_data(skb, nskb->data, doffset); - if (pos >= offset + len) + if (fskb != skb_shinfo(skb)->frag_list) continue; if (!sg) {