linux 2.4.x && total lock from simple program

Arkadiusz Miskiewicz misiek at pld.ORG.PL
Fri Feb 2 10:37:00 CET 2001


On/Dnia Thu, Feb 01, 2001 at 08:31:12PM +0100, Arkadiusz Miskiewicz wrote/napisał(a)
>   retval = socketpair(PF_UNIX, SOCK_DGRAM, 0, sockets);
>   shutdown(sockets[0], SHUT_RDWR);
>   read(sockets[0], buf, 1);
> 
> locks 2.4 kernels 8) no patch at this moment.
and here is fix:

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;
 }
 
 /*
> 

-- 
Arkadiusz Miśkiewicz, AM2-6BONE    [ PLD GNU/Linux IPv6 ]
http://www.t17.ds.pwr.wroc.pl/~misiek/ipv6/   [ enabled ]



More information about the pld-devel-en mailing list