]> err.no Git - linux-2.6/commitdiff
[UDP]: Fix MSG_PROBE crash
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 3 Oct 2006 21:35:49 +0000 (14:35 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 4 Oct 2006 07:31:00 +0000 (00:31 -0700)
UDP tracks corking status through the pending variable.  The
IP layer also tracks it through the socket write queue.  It
is possible for the two to get out of sync when MSG_PROBE is
used.

This patch changes UDP to check the write queue to ensure
that the two stay in sync.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp.c
net/ipv6/udp.c

index 6d6142f9c478baa8c85dcf1d174a5a88f66d783a..865d75214a9ab1d741f3d8351359e95a0d8394e7 100644 (file)
@@ -675,6 +675,8 @@ do_append_data:
                udp_flush_pending_frames(sk);
        else if (!corkreq)
                err = udp_push_pending_frames(sk, up);
+       else if (unlikely(skb_queue_empty(&sk->sk_write_queue)))
+               up->pending = 0;
        release_sock(sk);
 
 out:
index 552ec0f449af1e1c5e8fdd6cf70ee07827dd874c..e0c3934a7e4bd82b81135e0e48f097299b3a2510 100644 (file)
@@ -770,6 +770,8 @@ do_append_data:
                udp_v6_flush_pending_frames(sk);
        else if (!corkreq)
                err = udp_v6_push_pending_frames(sk, up);
+       else if (unlikely(skb_queue_empty(&sk->sk_write_queue)))
+               up->pending = 0;
 
        if (dst) {
                if (connected) {