diff options
author | David S. Miller <davem@davemloft.net> | 2018-08-11 17:52:00 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-11 17:52:00 -0700 |
commit | 6a92ef08a1351e4977d6acde2196fa94e9c3a660 (patch) | |
tree | 3f237980c08af76beae04a6844ad254543ca4b9f /kernel/bpf/sockmap.c | |
parent | 9a95d9c6429bb58905fdfc95da2e1b7cc3fb55b7 (diff) | |
parent | ec0c96714e7ddeda4eccaa077f5646a0fd6e371f (diff) |
Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'kernel/bpf/sockmap.c')
-rw-r--r-- | kernel/bpf/sockmap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 0b38be5a955c..70c0755e8fc4 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -1045,12 +1045,12 @@ static int bpf_tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); while (msg_data_left(msg)) { - struct sk_msg_buff *m; + struct sk_msg_buff *m = NULL; bool enospc = false; int copy; if (sk->sk_err) { - err = sk->sk_err; + err = -sk->sk_err; goto out_err; } @@ -1113,8 +1113,11 @@ wait_for_sndbuf: set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); wait_for_memory: err = sk_stream_wait_memory(sk, &timeo); - if (err) + if (err) { + if (m && m != psock->cork) + free_start_sg(sk, m); goto out_err; + } } out_err: if (err < 0) |