]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
net/tls: Only attach to sockets in ESTABLISHED state
authorIlya Lesokhin <ilyal@mellanox.com>
Tue, 16 Jan 2018 13:31:52 +0000 (15:31 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 Jan 2018 21:05:28 +0000 (16:05 -0500)
commitd91c3e17f75f218022140dee18cf515292184a8f
tree16091e4f64022c88fd6d90704d133b945b2d0a5f
parentf8b39039cbf2a15f2b8c9f081e1cbd5dee00aaf5
net/tls: Only attach to sockets in ESTABLISHED state

Calling accept on a TCP socket with a TLS ulp attached results
in two sockets that share the same ulp context.
The ulp context is freed while a socket is destroyed, so
after one of the sockets is released, the second second will
trigger a use after free when it tries to access the ulp context
attached to it.
We restrict the TLS ulp to sockets in ESTABLISHED state
to prevent the scenario above.

Fixes: 3c4d7559159b ("tls: kernel TLS support")
Reported-by: syzbot+904e7cd6c5c741609228@syzkaller.appspotmail.com
Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_main.c