Re: [PATCH net] l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()

2016-11-19 Thread David Miller
From: Guillaume Nault Date: Fri, 18 Nov 2016 22:13:00 +0100 > Lock socket before checking the SOCK_ZAPPED flag in l2tp_ip6_bind(). > Without lock, a concurrent call could modify the socket flags between > the sock_flag(sk, SOCK_ZAPPED) test and the lock_sock() call. This

[PATCH net] l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()

2016-11-18 Thread Guillaume Nault
Lock socket before checking the SOCK_ZAPPED flag in l2tp_ip6_bind(). Without lock, a concurrent call could modify the socket flags between the sock_flag(sk, SOCK_ZAPPED) test and the lock_sock() call. This way, a socket could be inserted twice in l2tp_ip6_bind_table. Releasing it would then leave