Commit ccd1479e authored by David S. Miller's avatar David S. Miller

Merge branch 'net-tls-fix-poll-wake-up'

Jakub Kicinski says:

====================
net/tls: fix poll() wake up

This small fix + selftest series is very similar to the previous
commit 04b25a54 ("net/tls: fix no wakeup on partial reads").
This time instead of recvmsg we're fixing poll wake up.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 537de0c8 81a89ef6
......@@ -1958,7 +1958,8 @@ bool tls_sw_stream_read(const struct sock *sk)
ingress_empty = list_empty(&psock->ingress_msg);
rcu_read_unlock();
return !ingress_empty || ctx->recv_pkt;
return !ingress_empty || ctx->recv_pkt ||
!skb_queue_empty(&ctx->rx_list);
}
static int tls_read_size(struct strparser *strp, struct sk_buff *skb)
......
......@@ -644,6 +644,32 @@ TEST_F(tls, poll_wait)
EXPECT_EQ(recv(self->cfd, recv_mem, send_len, MSG_WAITALL), send_len);
}
TEST_F(tls, poll_wait_split)
{
struct pollfd fd = { 0, 0, 0 };
char send_mem[20] = {};
char recv_mem[15];
fd.fd = self->cfd;
fd.events = POLLIN;
/* Send 20 bytes */
EXPECT_EQ(send(self->fd, send_mem, sizeof(send_mem), 0),
sizeof(send_mem));
/* Poll with inf. timeout */
EXPECT_EQ(poll(&fd, 1, -1), 1);
EXPECT_EQ(fd.revents & POLLIN, 1);
EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), MSG_WAITALL),
sizeof(recv_mem));
/* Now the remaining 5 bytes of record data are in TLS ULP */
fd.fd = self->cfd;
fd.events = POLLIN;
EXPECT_EQ(poll(&fd, 1, -1), 1);
EXPECT_EQ(fd.revents & POLLIN, 1);
EXPECT_EQ(recv(self->cfd, recv_mem, sizeof(recv_mem), 0),
sizeof(send_mem) - sizeof(recv_mem));
}
TEST_F(tls, blocking)
{
size_t data = 100000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment