]> git.baikalelectronics.ru Git - 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)
commitbb81ec28021146d50230f13aff5f44b8cf315459
tree16091e4f64022c88fd6d90704d133b945b2d0a5f
parent2b00f964a7f058c2107a3c1231b4f6e5b380b8af
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: 3a71956a2d9a ("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