Commit 2c6e4a98 authored by David S. Miller's avatar David S. Miller

[AF_UNIX]: Serialize dgram read using semaphore just like stream.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aebeba09
......@@ -1535,9 +1535,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
msg->msg_namelen = 0;
down(&u->readsem);
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (!skb)
goto out;
goto out_unlock;
wake_up_interruptible(&u->peer_wait);
......@@ -1587,6 +1589,8 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
out_free:
skb_free_datagram(sk,skb);
out_unlock:
up(&u->readsem);
out:
return err;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment