Skip to content

Commit b06c19d

Browse files
weiny2davem330
authored andcommitted
net/tls: Fix kmap usage
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: e8f6979 ("net/tls: Add generic NIC offload infrastructure") Signed-off-by: Ira Weiny <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 444da3f commit b06c19d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/tls/tls_device.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page,
561561
{
562562
struct tls_context *tls_ctx = tls_get_ctx(sk);
563563
struct iov_iter msg_iter;
564-
char *kaddr = kmap(page);
564+
char *kaddr;
565565
struct kvec iov;
566566
int rc;
567567

@@ -576,6 +576,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page,
576576
goto out;
577577
}
578578

579+
kaddr = kmap(page);
579580
iov.iov_base = kaddr + offset;
580581
iov.iov_len = size;
581582
iov_iter_kvec(&msg_iter, WRITE, &iov, 1, size);

0 commit comments

Comments
 (0)