mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* AF_UNIX hangs
@ 2001-02-01 18:51 Alan Cox
  2001-02-01 19:49 ` kuznet
  2001-02-02  1:16 ` David S. Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Cox @ 2001-02-01 18:51 UTC (permalink / raw)
  To: linux-kernel

Looking at net/core/datagram.c:wait_for_packet the code will return 0
when the socket has been shutdown. That causes skb_recv_datagram to loop
which is in itself obviously incorrect for a shutdown socket (its in EOF
state)

I suspect it should read something like

	/* Socket shut down? */
	if (sk->shutdown & RCV_SHUTDOWN)
	{
   		current->state = TASK_RUNNING;
	  	remove_wait_queue(sk->sleep, &wait);
 		*err = 0;
 		return 1;
	}



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: AF_UNIX hangs
  2001-02-01 18:51 AF_UNIX hangs Alan Cox
@ 2001-02-01 19:49 ` kuznet
  2001-02-02  1:16 ` David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: kuznet @ 2001-02-01 19:49 UTC (permalink / raw)
  To: Alan Cox, Dave Miller; +Cc: linux-kernel

Hello!

> Looking at net/core/datagram.c:wait_for_packet the code will return 0

Yep... Damn, specially split errno and ready values and forgot to use
this. 8) Sorry.

Alexey



--- ../vger3-010130/linux/net/core/datagram.c	Thu Dec 28 22:44:08 2000
+++ linux/net/core/datagram.c	Thu Feb  1 22:45:47 2001
@@ -73,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))
@@ -100,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 majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: AF_UNIX hangs
  2001-02-01 18:51 AF_UNIX hangs Alan Cox
  2001-02-01 19:49 ` kuznet
@ 2001-02-02  1:16 ` David S. Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2001-02-02  1:16 UTC (permalink / raw)
  To: kuznet; +Cc: Alan Cox, linux-kernel


kuznet@ms2.inr.ac.ru writes:
 > Yep... Damn, specially split errno and ready values and forgot to use
 > this. 8) Sorry.

Patch applied.

Later,
David S. Miller
davem@redhat.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-02-02  1:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-01 18:51 AF_UNIX hangs Alan Cox
2001-02-01 19:49 ` kuznet
2001-02-02  1:16 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®