From patchwork Thu Jul 22 20:28:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 59643 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.180.67]) by ozlabs.org (Postfix) with ESMTP id D1C11B70E3 for ; Fri, 23 Jul 2010 06:28:12 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756164Ab0GVU2H (ORCPT ); Thu, 22 Jul 2010 16:28:07 -0400 Received: from 74-93-104-97-Washington.hfc.comcastbusiness.net ([74.93.104.97]:50026 "EHLO sunset.davemloft.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352Ab0GVU2E (ORCPT ); Thu, 22 Jul 2010 16:28:04 -0400 Received: from localhost (localhost [127.0.0.1]) by sunset.davemloft.net (Postfix) with ESMTP id D00BF24C090; Thu, 22 Jul 2010 13:28:20 -0700 (PDT) Date: Thu, 22 Jul 2010 13:28:20 -0700 (PDT) Message-Id: <20100722.132820.234331174.davem@davemloft.net> To: andrea@persephoneslair.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] Fix corruption of skb csum field in pskb_expand_head() of net/core/skbuff.c From: David Miller In-Reply-To: <20100722191234.GA832@cronus.persephoneslair.org> References: <20100722191234.GA832@cronus.persephoneslair.org> X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andrea Shepard Date: Thu, 22 Jul 2010 12:12:35 -0700 > Make pskb_expand_head() check ip_summed to make sure csum_start is really > csum_start and not csum before adjusting it. ... > Signed-off-by: Andrea Shepard Applied, but your email client corrupted tab characters into spaces so I had to apply your patch by hand. There is a similar bug in skb_copy_expand() so I fixed that too. Thanks again. -------------------- net: Fix skb_copy_expand() handling of ->csum_start It should only be adjusted if ip_summed == CHECKSUM_PARTIAL. Signed-off-by: David S. Miller --- net/core/skbuff.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c699159..ce88293 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -932,7 +932,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, copy_skb_header(n, skb); off = newheadroom - oldheadroom; - n->csum_start += off; + if (n->ip_summed == CHECKSUM_PARTIAL) + n->csum_start += off; #ifdef NET_SKBUFF_DATA_USES_OFFSET n->transport_header += off; n->network_header += off;