]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - include/net/sock.h
tcp: do not release socket ownership in tcp_close()
authorEric Dumazet <edumazet@google.com>
Wed, 29 May 2019 00:22:57 +0000 (01:22 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 24 Jun 2019 14:21:33 +0000 (16:21 +0200)
commitc4f6637909f7a9a13ac24d93ee93e1a581b917e0
tree7b18a9f16a6fb0266c942d3500a5a81df3d85836
parent2ca2d6e51f7fea746702312a2b5a1ec411b691b4
tcp: do not release socket ownership in tcp_close()

BugLink: https://bugs.launchpad.net/bugs/1830813
syzkaller was able to hit the WARN_ON(sock_owned_by_user(sk));
in tcp_close()

While a socket is being closed, it is very possible other
threads find it in rtnetlink dump.

tcp_get_info() will acquire the socket lock for a short amount
of time (slow = lock_sock_fast(sk)/unlock_sock_fast(sk, slow);),
enough to trigger the warning.

Fixes: 67db3e4bfbc9 ("tcp: no longer hold ehash lock while calling tcp_get_info()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8873c064d1de579ea23412a6d3eee972593f142b)
Signed-off-by: Ioanna Alifieraki <ioanna-maria.alifieraki@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/net/sock.h
net/core/sock.c
net/ipv4/tcp.c