l2tp: avoid deadlock in l2tp stats update
authorTom Parkin <tparkin@katalix.com>
Tue, 19 Mar 2013 06:11:22 +0000 (06:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Mar 2013 16:10:39 +0000 (12:10 -0400)
commit7b7c0719cd7afee725b920d75ec6a500b76107e6
tree4ea11a15d2ee815f62d649257a8491870a382504
parentcf2f5c886a209377daefd5d2ba0bcd49c3887813
l2tp: avoid deadlock in l2tp stats update

l2tp's u64_stats writers were incorrectly synchronised, making it possible to
deadlock a 64bit machine running a 32bit kernel simply by sending the l2tp
code netlink commands while passing data through l2tp sessions.

Previous discussion on netdev determined that alternative solutions such as
spinlock writer synchronisation or per-cpu data would bring unjustified
overhead, given that most users interested in high volume traffic will likely
be running 64bit kernels on 64bit hardware.

As such, this patch replaces l2tp's use of u64_stats with atomic_long_t,
thereby avoiding the deadlock.

Ref:
http://marc.info/?l=linux-netdev&m=134029167910731&w=2
http://marc.info/?l=linux-netdev&m=134079868111131&w=2

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h
net/l2tp/l2tp_debugfs.c
net/l2tp/l2tp_netlink.c
net/l2tp/l2tp_ppp.c