net/tls: don't copy negative amounts of data in reencrypt
authorJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 26 Apr 2019 00:35:09 +0000 (17:35 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Apr 2019 00:17:19 +0000 (20:17 -0400)
commit97e1caa517e22d62a283b876fb8aa5f4672c83dd
tree49c0a9a8eaf6ec2c1dc548f0e68fcc2c2f8ed91b
parentb2a20fd0725e8b259c528820033e29fdb3724549
net/tls: don't copy negative amounts of data in reencrypt

There is no guarantee the record starts before the skb frags.
If we don't check for this condition copy amount will get
negative, leading to reads and writes to random memory locations.
Familiar hilarity ensues.

Fixes: 4799ac81e52a ("tls: Add rx inline crypto offload")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_device.c