summaryrefslogtreecommitdiff
blob: 6ced78404a2d825c329e8624a11b067e2de13027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- linux-2.4.27/net/unix/af_unix.c	2004-11-24 08:23:21 -08:00
+++ linux-2.4.28/net/unix/af_unix.c	2004-11-24 08:23:21 -08:00
@@ -1403,9 +1403,11 @@
 
 	msg->msg_namelen = 0;
 
+	down(&sk->protinfo.af_unix.readsem);
+
 	skb = skb_recv_datagram(sk, flags, noblock, &err);
 	if (!skb)
-		goto out;
+		goto out_unlock;
 
 	wake_up_interruptible(&sk->protinfo.af_unix.peer_wait);
 
@@ -1449,6 +1451,8 @@
 
 out_free:
 	skb_free_datagram(sk,skb);
+out_unlock:
+	up(&sk->protinfo.af_unix.readsem);
 out:
 	return err;
 }