From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:35735 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753754AbbIZSlQ (ORCPT ); Sat, 26 Sep 2015 14:41:16 -0400 Subject: Patch "ipv4: off-by-one in continuation handling in /proc/net/route" has been added to the 4.1-stable tree To: apw@canonical.com, alexander.h.duyck@redhat.com, davem@davemloft.net, gregkh@linuxfoundation.org Cc: , From: Date: Sat, 26 Sep 2015 11:41:16 -0700 Message-ID: <14432928768522@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled ipv4: off-by-one in continuation handling in /proc/net/route to the 4.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ipv4-off-by-one-in-continuation-handling-in-proc-net-route.patch and it can be found in the queue-4.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From foo@baz Sat Sep 26 11:13:07 PDT 2015 From: Andy Whitcroft Date: Thu, 13 Aug 2015 20:49:01 +0100 Subject: ipv4: off-by-one in continuation handling in /proc/net/route From: Andy Whitcroft [ Upstream commit 25b97c016b26039982daaa2c11d83979f93b71ab ] When generating /proc/net/route we emit a header followed by a line for each route. When a short read is performed we will restart this process based on the open file descriptor. When calculating the start point we fail to take into account that the 0th entry is the header. This leads us to skip the first entry when doing a continuation read. This can be easily seen with the comparison below: while read l; do echo "$l"; done A cat /proc/net/route >B diff -bu A B | grep '^[+-]' On my example machine I have approximatly 10KB of route output. There we see the very first non-title element is lost in the while read case, and an entry around the 8K mark in the cat case: +wlan0 00000000 02021EAC 0003 0 0 400 00000000 0 0 0 -tun1 00C0AC0A 00000000 0001 0 0 950 00C0FFFF 0 0 0 Fix up the off-by-one when reaquiring position on continuation. Fixes: 8be33e955cb9 ("fib_trie: Fib walk rcu should take a tnode and key instead of a trie and a leaf") BugLink: http://bugs.launchpad.net/bugs/1483440 Acked-by: Alexander Duyck Signed-off-by: Andy Whitcroft Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/fib_trie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -2453,7 +2453,7 @@ static struct key_vector *fib_route_get_ key = l->key + 1; iter->pos++; - if (pos-- <= 0) + if (--pos <= 0) break; l = NULL; Patches currently in stable-queue which might be from apw@canonical.com are queue-4.1/ipv4-off-by-one-in-continuation-handling-in-proc-net-route.patch