mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
net/tls: free the record on encryption error
[ Upstream commit d10523d0b3d78153ee58d19853ced26c9004c8c4 ] When tls_do_encryption() fails the SG lists are left with the SG_END and SG_CHAIN marks in place. One could hope that once encryption fails we will never see the record again, but that is in fact not true. Commitd3b18ad31f("tls: add bpf support to sk_msg handling") added special handling to ENOMEM and ENOSPC errors which mean we may see the same record re-submitted. As suggested by John free the record, the BPF code is already doing just that. Reported-by: [email protected] Fixes:d3b18ad31f("tls: add bpf support to sk_msg handling") Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Acked-by: John Fastabend <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
a85ca00279
commit
795c687eac
1 changed files with 8 additions and 2 deletions
|
|
@ -766,8 +766,14 @@ static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk,
|
|||
|
||||
policy = !(flags & MSG_SENDPAGE_NOPOLICY);
|
||||
psock = sk_psock_get(sk);
|
||||
if (!psock || !policy)
|
||||
return tls_push_record(sk, flags, record_type);
|
||||
if (!psock || !policy) {
|
||||
err = tls_push_record(sk, flags, record_type);
|
||||
if (err) {
|
||||
*copied -= sk_msg_free(sk, msg);
|
||||
tls_free_open_rec(sk);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
more_data:
|
||||
enospc = sk_msg_full(msg);
|
||||
if (psock->eval == __SK_NONE) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue