diff options
-rw-r--r-- | kernel/bpf/sockmap.c | 9 | ||||
-rw-r--r-- | tools/testing/selftests/bpf/test_sockmap.c | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 98fb7938beea..c4d75c52b4fc 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c | |||
@@ -1048,12 +1048,12 @@ static int bpf_tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) | |||
1048 | timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); | 1048 | timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); |
1049 | 1049 | ||
1050 | while (msg_data_left(msg)) { | 1050 | while (msg_data_left(msg)) { |
1051 | struct sk_msg_buff *m; | 1051 | struct sk_msg_buff *m = NULL; |
1052 | bool enospc = false; | 1052 | bool enospc = false; |
1053 | int copy; | 1053 | int copy; |
1054 | 1054 | ||
1055 | if (sk->sk_err) { | 1055 | if (sk->sk_err) { |
1056 | err = sk->sk_err; | 1056 | err = -sk->sk_err; |
1057 | goto out_err; | 1057 | goto out_err; |
1058 | } | 1058 | } |
1059 | 1059 | ||
@@ -1116,8 +1116,11 @@ wait_for_sndbuf: | |||
1116 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | 1116 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
1117 | wait_for_memory: | 1117 | wait_for_memory: |
1118 | err = sk_stream_wait_memory(sk, &timeo); | 1118 | err = sk_stream_wait_memory(sk, &timeo); |
1119 | if (err) | 1119 | if (err) { |
1120 | if (m && m != psock->cork) | ||
1121 | free_start_sg(sk, m); | ||
1120 | goto out_err; | 1122 | goto out_err; |
1123 | } | ||
1121 | } | 1124 | } |
1122 | out_err: | 1125 | out_err: |
1123 | if (err < 0) | 1126 | if (err < 0) |
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index 9e78df207919..0c7d9e556b47 100644 --- a/tools/testing/selftests/bpf/test_sockmap.c +++ b/tools/testing/selftests/bpf/test_sockmap.c | |||
@@ -354,7 +354,7 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, | |||
354 | while (s->bytes_recvd < total_bytes) { | 354 | while (s->bytes_recvd < total_bytes) { |
355 | if (txmsg_cork) { | 355 | if (txmsg_cork) { |
356 | timeout.tv_sec = 0; | 356 | timeout.tv_sec = 0; |
357 | timeout.tv_usec = 1000; | 357 | timeout.tv_usec = 300000; |
358 | } else { | 358 | } else { |
359 | timeout.tv_sec = 1; | 359 | timeout.tv_sec = 1; |
360 | timeout.tv_usec = 0; | 360 | timeout.tv_usec = 0; |