]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: prevent sign extension in dev_get_stats()
authorEric Dumazet <edumazet@google.com>
Tue, 27 Jun 2017 14:02:20 +0000 (07:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jul 2017 05:00:05 +0000 (07:00 +0200)
commit28b35b3ffbe0eb9fae8b1b6e7f680a8648dea2f7
treef3f2673dc417a389cc6761fcefd3261385362d7c
parent85c1186f5df971d6d30affb7c064a7841ccdbd3a
net: prevent sign extension in dev_get_stats()

[ Upstream commit 6f64ec74515925cced6df4571638b5a099a49aae ]

Similar to the fix provided by Dominik Heidler in commit
9b3dc0a17d73 ("l2tp: cast l2tp traffic counter to unsigned")
we need to take care of 32bit kernels in dev_get_stats().

When using atomic_long_read(), we add a 'long' to u64 and
might misinterpret high order bit, unless we cast to unsigned.

Fixes: caf586e5f23ce ("net: add a core netdev->rx_dropped counter")
Fixes: 015f0688f57ca ("net: net: add a core netdev->tx_dropped counter")
Fixes: 6e7333d315a76 ("net: add rx_nohandler stat counter")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/dev.c