net/tls: fix encryption error checking
authorVadim Fedorenko <vfedorenko@novek.ru>
Wed, 20 May 2020 08:41:43 +0000 (11:41 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jun 2020 06:21:05 +0000 (08:21 +0200)
commitcff9e73a34a2a4c087966cf781e1e5eba64f55ca
tree2a2b674dacd8f964f9490d53fe820c3bcd3df4f7
parent3f4f034a8676e366857861e76c3ad11ae059b2fb
net/tls: fix encryption error checking

commit a7bff11f6f9afa87c25711db8050c9b5324db0e2 upstream.

bpf_exec_tx_verdict() can return negative value for copied
variable. In that case this value will be pushed back to caller
and the real error code will be lost. Fix it using signed type and
checking for positive value.

Fixes: d10523d0b3d7 ("net/tls: free the record on encryption error")
Fixes: d3b18ad31f93 ("tls: add bpf support to sk_msg handling")
Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/tls/tls_sw.c