Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764189AbXLMHM3 (ORCPT ); Thu, 13 Dec 2007 02:12:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761964AbXLMG5n (ORCPT ); Thu, 13 Dec 2007 01:57:43 -0500 Received: from pentafluge.infradead.org ([213.146.154.40]:55513 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762605AbXLMG5l (ORCPT ); Thu, 13 Dec 2007 01:57:41 -0500 Date: Wed, 12 Dec 2007 22:52:58 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org, davem@davemloft.net Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Eric Dumazet , Herbert Xu Subject: [patch 39/60] NET: Corrects a bug in ip_rt_acct_read() Message-ID: <20071213065258.GO6867@kroah.com> References: <20071213064518.328162328@mini.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="net-corrects-a-bug-in-ip_rt_acct_read.patch" In-Reply-To: <20071213065039.GA6867@kroah.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1636 Lines: 55 2.6.23-stable review patch. If anyone has any objections, please let us know. ------------------ From: Eric Dumazet [NET]: Corrects a bug in ip_rt_acct_read() [ Upstream commit: 483b23ffa3a5f44767038b0a676d757e0668437e ] It seems that stats of cpu 0 are counted twice, since for_each_possible_cpu() is looping on all possible cpus, including 0 Before percpu conversion of ip_rt_acct, we should also remove the assumption that CPU 0 is online (or even possible) Signed-off-by: Eric Dumazet Cc: Herbert Xu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/route.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2913,18 +2913,14 @@ static int ip_rt_acct_read(char *buffer, offset /= sizeof(u32); if (length > 0) { - u32 *src = ((u32 *) IP_RT_ACCT_CPU(0)) + offset; u32 *dst = (u32 *) buffer; - /* Copy first cpu. */ *start = buffer; - memcpy(dst, src, length); + memset(dst, 0, length); - /* Add the other cpus in, one int at a time */ for_each_possible_cpu(i) { unsigned int j; - - src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset; + u32 *src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset; for (j = 0; j < length/4; j++) dst[j] += src[j]; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/