aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index d545e1d0dea2..68bb70a62afe 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -637,7 +637,7 @@ static int unix_stream_connect(struct socket *, struct sockaddr *,
637 int addr_len, int flags); 637 int addr_len, int flags);
638static int unix_socketpair(struct socket *, struct socket *); 638static int unix_socketpair(struct socket *, struct socket *);
639static int unix_accept(struct socket *, struct socket *, int, bool); 639static int unix_accept(struct socket *, struct socket *, int, bool);
640static int unix_getname(struct socket *, struct sockaddr *, int *, int); 640static int unix_getname(struct socket *, struct sockaddr *, int);
641static __poll_t unix_poll(struct file *, struct socket *, poll_table *); 641static __poll_t unix_poll(struct file *, struct socket *, poll_table *);
642static __poll_t unix_dgram_poll(struct file *, struct socket *, 642static __poll_t unix_dgram_poll(struct file *, struct socket *,
643 poll_table *); 643 poll_table *);
@@ -745,14 +745,6 @@ static struct proto unix_proto = {
745 .obj_size = sizeof(struct unix_sock), 745 .obj_size = sizeof(struct unix_sock),
746}; 746};
747 747
748/*
749 * AF_UNIX sockets do not interact with hardware, hence they
750 * dont trigger interrupts - so it's safe for them to have
751 * bh-unsafe locking for their sk_receive_queue.lock. Split off
752 * this special lock-class by reinitializing the spinlock key:
753 */
754static struct lock_class_key af_unix_sk_receive_queue_lock_key;
755
756static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) 748static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
757{ 749{
758 struct sock *sk = NULL; 750 struct sock *sk = NULL;
@@ -767,8 +759,6 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
767 goto out; 759 goto out;
768 760
769 sock_init_data(sock, sk); 761 sock_init_data(sock, sk);
770 lockdep_set_class(&sk->sk_receive_queue.lock,
771 &af_unix_sk_receive_queue_lock_key);
772 762
773 sk->sk_allocation = GFP_KERNEL_ACCOUNT; 763 sk->sk_allocation = GFP_KERNEL_ACCOUNT;
774 sk->sk_write_space = unix_write_space; 764 sk->sk_write_space = unix_write_space;
@@ -1453,7 +1443,7 @@ out:
1453} 1443}
1454 1444
1455 1445
1456static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) 1446static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int peer)
1457{ 1447{
1458 struct sock *sk = sock->sk; 1448 struct sock *sk = sock->sk;
1459 struct unix_sock *u; 1449 struct unix_sock *u;
@@ -1476,12 +1466,12 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
1476 if (!u->addr) { 1466 if (!u->addr) {
1477 sunaddr->sun_family = AF_UNIX; 1467 sunaddr->sun_family = AF_UNIX;
1478 sunaddr->sun_path[0] = 0; 1468 sunaddr->sun_path[0] = 0;
1479 *uaddr_len = sizeof(short); 1469 err = sizeof(short);
1480 } else { 1470 } else {
1481 struct unix_address *addr = u->addr; 1471 struct unix_address *addr = u->addr;
1482 1472
1483 *uaddr_len = addr->len; 1473 err = addr->len;
1484 memcpy(sunaddr, addr->name, *uaddr_len); 1474 memcpy(sunaddr, addr->name, addr->len);
1485 } 1475 }
1486 unix_state_unlock(sk); 1476 unix_state_unlock(sk);
1487 sock_put(sk); 1477 sock_put(sk);
@@ -1825,7 +1815,7 @@ out:
1825} 1815}
1826 1816
1827/* We use paged skbs for stream sockets, and limit occupancy to 32768 1817/* We use paged skbs for stream sockets, and limit occupancy to 32768
1828 * bytes, and a minimun of a full page. 1818 * bytes, and a minimum of a full page.
1829 */ 1819 */
1830#define UNIX_SKB_FRAGS_SZ (PAGE_SIZE << get_order(32768)) 1820#define UNIX_SKB_FRAGS_SZ (PAGE_SIZE << get_order(32768))
1831 1821