tls: fix sw_ctx leak
authorSabrina Dubroca <sd@queasysnail.net>
Tue, 16 Jan 2018 15:04:26 +0000 (16:04 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 Jan 2018 21:16:03 +0000 (16:16 -0500)
commitcf6d43ef66f416282121f436ce1bee9a25199d52
tree0e2e7f8c15b36422f69874435375d3445688893f
parent6ab6dd9e7f18dea51a6d65c0c28f0fd74332bfe6
tls: fix sw_ctx leak

During setsockopt(SOL_TCP, TLS_TX), if initialization of the software
context fails in tls_set_sw_offload(), we leak sw_ctx. We also don't
reassign ctx->priv_ctx to NULL, so we can't even do another attempt to
set it up on the same socket, as it will fail with -EEXIST.

Fixes: 3c4d7559159b ('tls: kernel TLS support')
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c