]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tipc: use lock_sock() in tipc_sk_reinit()
authorCong Wang <xiyou.wangcong@gmail.com>
Mon, 10 Dec 2018 19:49:55 +0000 (11:49 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit7f8ec35d5a1916c814b73e0e4a0fe602494f91c9
tree913bbde92ca3e7b1ce51e0bb8a4b1d2e4135c894
parent741ad826606e9f01f93e39449f3c9f950e075efd
tipc: use lock_sock() in tipc_sk_reinit()

BugLink: https://bugs.launchpad.net/bugs/1837257
[ Upstream commit 15ef70e286176165d28b0b8a969b422561a68dfc ]

lock_sock() must be used in process context to be race-free with
other lock_sock() callers, for example, tipc_release(). Otherwise
using the spinlock directly can't serialize a parallel tipc_release().

As it is blocking, we have to hold the sock refcnt before
rhashtable_walk_stop() and release it after rhashtable_walk_start().

Fixes: 07f6c4bc048a ("tipc: convert tipc reference table to use generic rhashtable")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Ying Xue <ying.xue@windriver.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/tipc/socket.c