]> git.baikalelectronics.ru Git - kernel.git/commit
tls: Do not call sk_memcopy_from_iter with zero length
authorVakul Garg <vakul.garg@nxp.com>
Fri, 21 Dec 2018 15:16:52 +0000 (15:16 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Dec 2018 18:26:54 +0000 (10:26 -0800)
commit323bb72c31a2c2f25ffc1392b8ad2fa67075536f
tree2d84674e27f79bdc7cabcfb63167db3edf892b72
parent8d94b061cb9973b09b44a8a4b7cdbd4c39cabd58
tls: Do not call sk_memcopy_from_iter with zero length

In some conditions e.g. when tls_clone_plaintext_msg() returns -ENOSPC,
the number of bytes to be copied using subsequent function
sk_msg_memcopy_from_iter() becomes zero. This causes function
sk_msg_memcopy_from_iter() to fail which in turn causes tls_sw_sendmsg()
to return failure. To prevent it, do not call sk_msg_memcopy_from_iter()
when number of bytes to copy (indicated by 'try_to_copy') is zero.

Fixes: 1a40c5d6e820 ("tls: convert to generic sk_msg interface")
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c