aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2020-08-10 17:02:58 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-19 08:16:23 +0200
commit49a5b473bc66d6f561d68a062c0708d4a0789400 (patch)
treef511249901cf58bdae74c70fb52d98b5e858e0ad
parent7bedf1d86298c98240add8fcd8eafd8f2d9f2d2f (diff)
downloadlinux-yocto-49a5b473bc66d6f561d68a062c0708d4a0789400.tar.gz
linux-yocto-49a5b473bc66d6f561d68a062c0708d4a0789400.tar.bz2
linux-yocto-49a5b473bc66d6f561d68a062c0708d4a0789400.zip
net/tls: Fix kmap usage
[ Upstream commit b06c19d9f827f6743122795570bfc0c72db482b0 ] When MSG_OOB is specified to tls_device_sendpage() the mapped page is never unmapped. Hold off mapping the page until after the flags are checked and the page is actually needed. Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") Signed-off-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/tls/tls_device.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 1adeb1c0473b..25fca390cdcf 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -549,7 +549,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page,
{
struct tls_context *tls_ctx = tls_get_ctx(sk);
struct iov_iter msg_iter;
- char *kaddr = kmap(page);
+ char *kaddr;
struct kvec iov;
int rc;
@@ -564,6 +564,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page,
goto out;
}
+ kaddr = kmap(page);
iov.iov_base = kaddr + offset;
iov.iov_len = size;
iov_iter_kvec(&msg_iter, WRITE, &iov, 1, size);