]> git.baikalelectronics.ru Git - kernel.git/commit
net/tls: free the record on encryption error
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 27 Nov 2019 20:16:40 +0000 (12:16 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Nov 2019 06:40:29 +0000 (22:40 -0800)
commitc7e51a9c5c8378da98efc173d98bc6c10e515920
tree8e86eea39a1cfc9a35cc3abb86e532915f0e10c7
parentaca6fa20469453c0f7fa9ab583b1c0b5470e74fe
net/tls: free the record on encryption error

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. Commit 7f1e5e018bbc ("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: syzbot+df0d4ec12332661dd1f9@syzkaller.appspotmail.com
Fixes: 7f1e5e018bbc ("tls: add bpf support to sk_msg handling")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c