OSDN Git Service

tcp: Schedule rmem for rcvq repair send
authorPavel Emelyanov <xemul@parallels.com>
Thu, 10 May 2012 01:50:01 +0000 (01:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 May 2012 03:24:35 +0000 (23:24 -0400)
As noted by Eric, no checks are performed on the data size we're
putting in the read queue during repair. Thus, validate the given
data size with the common rmem management routine.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c

index 7c6c99d..164659f 100644 (file)
@@ -4769,6 +4769,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
        struct tcphdr *th;
        bool fragstolen;
 
+       if (tcp_try_rmem_schedule(sk, size + sizeof(*th)))
+               goto err;
+
        skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
        if (!skb)
                goto err;