diff options
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2b00460f2886..2b4cc2eea5b3 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -566,7 +566,7 @@ static struct sock * unix_create1(struct socket *sock) | |||
566 | u->mnt = NULL; | 566 | u->mnt = NULL; |
567 | spin_lock_init(&u->lock); | 567 | spin_lock_init(&u->lock); |
568 | atomic_set(&u->inflight, sock ? 0 : -1); | 568 | atomic_set(&u->inflight, sock ? 0 : -1); |
569 | init_MUTEX(&u->readsem); /* single task reading lock */ | 569 | mutex_init(&u->readlock); /* single task reading lock */ |
570 | init_waitqueue_head(&u->peer_wait); | 570 | init_waitqueue_head(&u->peer_wait); |
571 | unix_insert_socket(unix_sockets_unbound, sk); | 571 | unix_insert_socket(unix_sockets_unbound, sk); |
572 | out: | 572 | out: |
@@ -623,7 +623,7 @@ static int unix_autobind(struct socket *sock) | |||
623 | struct unix_address * addr; | 623 | struct unix_address * addr; |
624 | int err; | 624 | int err; |
625 | 625 | ||
626 | down(&u->readsem); | 626 | mutex_lock(&u->readlock); |
627 | 627 | ||
628 | err = 0; | 628 | err = 0; |
629 | if (u->addr) | 629 | if (u->addr) |
@@ -661,7 +661,7 @@ retry: | |||
661 | spin_unlock(&unix_table_lock); | 661 | spin_unlock(&unix_table_lock); |
662 | err = 0; | 662 | err = 0; |
663 | 663 | ||
664 | out: up(&u->readsem); | 664 | out: mutex_unlock(&u->readlock); |
665 | return err; | 665 | return err; |
666 | } | 666 | } |
667 | 667 | ||
@@ -744,7 +744,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
744 | goto out; | 744 | goto out; |
745 | addr_len = err; | 745 | addr_len = err; |
746 | 746 | ||
747 | down(&u->readsem); | 747 | mutex_lock(&u->readlock); |
748 | 748 | ||
749 | err = -EINVAL; | 749 | err = -EINVAL; |
750 | if (u->addr) | 750 | if (u->addr) |
@@ -816,7 +816,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
816 | out_unlock: | 816 | out_unlock: |
817 | spin_unlock(&unix_table_lock); | 817 | spin_unlock(&unix_table_lock); |
818 | out_up: | 818 | out_up: |
819 | up(&u->readsem); | 819 | mutex_unlock(&u->readlock); |
820 | out: | 820 | out: |
821 | return err; | 821 | return err; |
822 | 822 | ||
@@ -1545,7 +1545,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1545 | 1545 | ||
1546 | msg->msg_namelen = 0; | 1546 | msg->msg_namelen = 0; |
1547 | 1547 | ||
1548 | down(&u->readsem); | 1548 | mutex_lock(&u->readlock); |
1549 | 1549 | ||
1550 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 1550 | skb = skb_recv_datagram(sk, flags, noblock, &err); |
1551 | if (!skb) | 1551 | if (!skb) |
@@ -1600,7 +1600,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1600 | out_free: | 1600 | out_free: |
1601 | skb_free_datagram(sk,skb); | 1601 | skb_free_datagram(sk,skb); |
1602 | out_unlock: | 1602 | out_unlock: |
1603 | up(&u->readsem); | 1603 | mutex_unlock(&u->readlock); |
1604 | out: | 1604 | out: |
1605 | return err; | 1605 | return err; |
1606 | } | 1606 | } |
@@ -1676,7 +1676,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1676 | memset(&tmp_scm, 0, sizeof(tmp_scm)); | 1676 | memset(&tmp_scm, 0, sizeof(tmp_scm)); |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | down(&u->readsem); | 1679 | mutex_lock(&u->readlock); |
1680 | 1680 | ||
1681 | do | 1681 | do |
1682 | { | 1682 | { |
@@ -1700,7 +1700,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1700 | err = -EAGAIN; | 1700 | err = -EAGAIN; |
1701 | if (!timeo) | 1701 | if (!timeo) |
1702 | break; | 1702 | break; |
1703 | up(&u->readsem); | 1703 | mutex_unlock(&u->readlock); |
1704 | 1704 | ||
1705 | timeo = unix_stream_data_wait(sk, timeo); | 1705 | timeo = unix_stream_data_wait(sk, timeo); |
1706 | 1706 | ||
@@ -1708,7 +1708,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1708 | err = sock_intr_errno(timeo); | 1708 | err = sock_intr_errno(timeo); |
1709 | goto out; | 1709 | goto out; |
1710 | } | 1710 | } |
1711 | down(&u->readsem); | 1711 | mutex_lock(&u->readlock); |
1712 | continue; | 1712 | continue; |
1713 | } | 1713 | } |
1714 | 1714 | ||
@@ -1774,7 +1774,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1774 | } | 1774 | } |
1775 | } while (size); | 1775 | } while (size); |
1776 | 1776 | ||
1777 | up(&u->readsem); | 1777 | mutex_unlock(&u->readlock); |
1778 | scm_recv(sock, msg, siocb->scm, flags); | 1778 | scm_recv(sock, msg, siocb->scm, flags); |
1779 | out: | 1779 | out: |
1780 | return copied ? : err; | 1780 | return copied ? : err; |