Prasanna P Subash writes:
 > I looked at the skb_recv_datagram code and noticed that wait_for_packet is not
 > returning an error, even while trying to read a closed socket.
 > Anyways here is a patch against 2.4.1 that will fix the issue.
 > Please feel free to flame me about the patch :)

Please read the rest of today's postings, Alexey Kuznetsov already
posted the correct fix, which I'm attached below:

diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore 
vanilla/linux/net/core/datagram.c linux/net/core/datagram.c
--- vanilla/linux/net/core/datagram.c   Sat Nov 11 19:02:40 2000
+++ linux/net/core/datagram.c   Thu Feb  1 17:15:12 2001
@@ -72,19 +73,19 @@
        /* Socket errors? */
        error = sock_error(sk);
        if (error)
-               goto out;
+               goto out_err;
 
        if (!skb_queue_empty(&sk->receive_queue))
                goto ready;
 
        /* Socket shut down? */
        if (sk->shutdown & RCV_SHUTDOWN)
-               goto out;
+               goto out_noerr;
 
        /* Sequenced packets can come disconnected. If so we report the problem */
        error = -ENOTCONN;
        if(connection_based(sk) && !(sk->state==TCP_ESTABLISHED || 
sk->state==TCP_LISTEN))
-               goto out;
+               goto out_err;
 
        /* handle signals */
        if (signal_pending(current))
@@ -99,11 +100,16 @@
 
 interrupted:
        error = sock_intr_errno(*timeo_p);
+out_err:
+       *err = error;
 out:
        current->state = TASK_RUNNING;
        remove_wait_queue(sk->sleep, &wait);
-       *err = error;
        return error;
+out_noerr:
+       *err = 0;
+       error = 1;
+       goto out;
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to