aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index cd3c7e95de9e..450f44bb2c8e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1064,7 +1064,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1064 break; 1064 break;
1065 } 1065 }
1066 used = recv_actor(desc, skb, offset, len); 1066 used = recv_actor(desc, skb, offset, len);
1067 if (used <= len) { 1067 if (used < 0) {
1068 if (!copied)
1069 copied = used;
1070 break;
1071 } else if (used <= len) {
1068 seq += used; 1072 seq += used;
1069 copied += used; 1073 copied += used;
1070 offset += used; 1074 offset += used;
@@ -1086,7 +1090,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1086 tcp_rcv_space_adjust(sk); 1090 tcp_rcv_space_adjust(sk);
1087 1091
1088 /* Clean up data we have read: This will do ACK frames. */ 1092 /* Clean up data we have read: This will do ACK frames. */
1089 if (copied) 1093 if (copied > 0)
1090 tcp_cleanup_rbuf(sk, copied); 1094 tcp_cleanup_rbuf(sk, copied);
1091 return copied; 1095 return copied;
1092} 1096}