diff options
author | Christoph Paasch <christoph.paasch@uclouvain.be> | 2014-01-16 20:01:21 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-06 11:22:20 -0800 |
commit | 5e3b0f65e71dfa5c1a2e276f1a0df01a79aa07e3 (patch) | |
tree | cd0b3f0fed81a59e3e70bbc8d1c1f83ecf457cce /net/core | |
parent | c2d828a8e5dcea50926bde6277741aafb4ca4927 (diff) |
tcp: metrics: Avoid duplicate entries with the same destination-IP
[ Upstream commit 77f99ad16a07aa062c2d30fae57b1fee456f6ef6 ]
Because the tcp-metrics is an RCU-list, it may be that two
soft-interrupts are inside __tcp_get_metrics() for the same
destination-IP at the same time. If this destination-IP is not yet part of
the tcp-metrics, both soft-interrupts will end up in tcpm_new and create
a new entry for this IP.
So, we will have two tcp-metrics with the same destination-IP in the list.
This patch checks twice __tcp_get_metrics(). First without holding the
lock, then while holding the lock. The second one is there to confirm
that the entry has not been added by another soft-irq while waiting for
the spin-lock.
Fixes: 51c5d0c4b169b (tcp: Maintain dynamic metrics in local cache.)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/core')
0 files changed, 0 insertions, 0 deletions