Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ddb61a57bb6df673986e6476407f97d28b02031f
Commit:     ddb61a57bb6df673986e6476407f97d28b02031f
Parent:     4b2a8fb3a7f7935f62a7bbdc851789fb7c2da032
Author:     Jens Axboe <[EMAIL PROTECTED]>
AuthorDate: Sat Jun 23 23:07:50 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Sat Jun 23 23:07:50 2007 -0700

    [TCP] tcp_read_sock: Allow recv_actor() return return negative error value.
    
    tcp_read_sock() currently assumes that the recv_actor() only returns
    number of bytes copied. For network splice receive, we may have to
    return an error in some cases. So allow the actor to return a negative
    error value.
    
    Signed-off-by: Jens Axboe <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/tcp.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index cd3c7e9..450f44b 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,
                                        break;
                        }
                        used = recv_actor(desc, skb, offset, len);
-                       if (used <= len) {
+                       if (used < 0) {
+                               if (!copied)
+                                       copied = used;
+                               break;
+                       } else if (used <= len) {
                                seq += used;
                                copied += used;
                                offset += used;
@@ -1086,7 +1090,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t 
*desc,
        tcp_rcv_space_adjust(sk);
 
        /* Clean up data we have read: This will do ACK frames. */
-       if (copied)
+       if (copied > 0)
                tcp_cleanup_rbuf(sk, copied);
        return copied;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to