Skip to content

Commit 034ea13

Browse files
jrfastabdavem330
authored andcommitted
net: tls, add test to capture error on large splice
syzbot found an error with how splice() is handled with a msg greater than 32. This was fixed in previous patch, but lets add a test for it to ensure it continues to work. Signed-off-by: John Fastabend <john.fastabend@gmail.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dc9dfc8 commit 034ea13

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • tools/testing/selftests/net

tools/testing/selftests/net/tls.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,20 @@ TEST_F(tls, splice_from_pipe)
707707
EXPECT_EQ(memcmp(mem_send, mem_recv, send_len), 0);
708708
}
709709

710+
TEST_F(tls, splice_more)
711+
{
712+
unsigned int f = SPLICE_F_NONBLOCK | SPLICE_F_MORE | SPLICE_F_GIFT;
713+
int send_len = TLS_PAYLOAD_MAX_LEN;
714+
char mem_send[TLS_PAYLOAD_MAX_LEN];
715+
int i, send_pipe = 1;
716+
int p[2];
717+
718+
ASSERT_GE(pipe(p), 0);
719+
EXPECT_GE(write(p[1], mem_send, send_len), 0);
720+
for (i = 0; i < 32; i++)
721+
EXPECT_EQ(splice(p[0], NULL, self->fd, NULL, send_pipe, f), 1);
722+
}
723+
710724
TEST_F(tls, splice_from_pipe2)
711725
{
712726
int send_len = 16000;

0 commit comments

Comments
 (0)