]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commit
fib_trie: Correct /proc/net/route off by one error
authorAlexander Duyck <alexander.h.duyck@intel.com>
Fri, 4 Nov 2016 19:11:57 +0000 (15:11 -0400)
committerIshan Mittal <imittal@nvidia.com>
Fri, 6 Jan 2017 10:18:09 +0000 (15:48 +0530)
commit84655bb85ab80f750d8f0e789a5ad31a4d78f5cf
treeaba40e48819540f019f6498527d90ee5fc6cf1e9
parent64a684fa267d67d6b3c3cc559181db02d22da18f
fib_trie: Correct /proc/net/route off by one error

[ Upstream commit fd0285a39b1cb496f60210a9a00ad33a815603e7 ]

The display of /proc/net/route has had a couple issues due to the fact that
when I originally rewrote most of fib_trie I made it so that the iterator
was tracking the next value to use instead of the current.

In addition it had an off by 1 error where I was tracking the first piece
of data as position 0, even though in reality that belonged to the
SEQ_START_TOKEN.

This patch updates the code so the iterator tracks the last reported
position and key instead of the next expected position and key.  In
addition it shifts things so that all of the leaves start at 1 instead of
trying to report leaves starting with offset 0 as being valid.  With these
two issues addressed this should resolve any off by one errors that were
present in the display of /proc/net/route.

Fixes: 25b97c016b26 ("ipv4: off-by-one in continuation handling in /proc/net/route")
Cc: Andy Whitcroft <apw@canonical.com>
Reported-by: Jason Baron <jbaron@akamai.com>
Tested-by: Jason Baron <jbaron@akamai.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/fib_trie.c