diff options
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 8ee85aa79fa..eb4277c3318 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -293,7 +293,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i) | |||
| 293 | spin_lock(&unix_table_lock); | 293 | spin_lock(&unix_table_lock); |
| 294 | sk_for_each(s, node, | 294 | sk_for_each(s, node, |
| 295 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { | 295 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { |
| 296 | struct dentry *dentry = unix_sk(s)->dentry; | 296 | struct dentry *dentry = unix_sk(s)->path.dentry; |
| 297 | 297 | ||
| 298 | if (dentry && dentry->d_inode == i) { | 298 | if (dentry && dentry->d_inode == i) { |
| 299 | sock_hold(s); | 299 | sock_hold(s); |
| @@ -377,8 +377,7 @@ static void unix_sock_destructor(struct sock *sk) | |||
| 377 | static int unix_release_sock(struct sock *sk, int embrion) | 377 | static int unix_release_sock(struct sock *sk, int embrion) |
| 378 | { | 378 | { |
| 379 | struct unix_sock *u = unix_sk(sk); | 379 | struct unix_sock *u = unix_sk(sk); |
| 380 | struct dentry *dentry; | 380 | struct path path; |
| 381 | struct vfsmount *mnt; | ||
| 382 | struct sock *skpair; | 381 | struct sock *skpair; |
| 383 | struct sk_buff *skb; | 382 | struct sk_buff *skb; |
| 384 | int state; | 383 | int state; |
| @@ -389,10 +388,9 @@ static int unix_release_sock(struct sock *sk, int embrion) | |||
| 389 | unix_state_lock(sk); | 388 | unix_state_lock(sk); |
| 390 | sock_orphan(sk); | 389 | sock_orphan(sk); |
| 391 | sk->sk_shutdown = SHUTDOWN_MASK; | 390 | sk->sk_shutdown = SHUTDOWN_MASK; |
| 392 | dentry = u->dentry; | 391 | path = u->path; |
| 393 | u->dentry = NULL; | 392 | u->path.dentry = NULL; |
| 394 | mnt = u->mnt; | 393 | u->path.mnt = NULL; |
| 395 | u->mnt = NULL; | ||
| 396 | state = sk->sk_state; | 394 | state = sk->sk_state; |
| 397 | sk->sk_state = TCP_CLOSE; | 395 | sk->sk_state = TCP_CLOSE; |
| 398 | unix_state_unlock(sk); | 396 | unix_state_unlock(sk); |
| @@ -425,10 +423,8 @@ static int unix_release_sock(struct sock *sk, int embrion) | |||
| 425 | kfree_skb(skb); | 423 | kfree_skb(skb); |
| 426 | } | 424 | } |
| 427 | 425 | ||
| 428 | if (dentry) { | 426 | if (path.dentry) |
| 429 | dput(dentry); | 427 | path_put(&path); |
| 430 | mntput(mnt); | ||
| 431 | } | ||
| 432 | 428 | ||
| 433 | sock_put(sk); | 429 | sock_put(sk); |
| 434 | 430 | ||
| @@ -641,8 +637,8 @@ static struct sock *unix_create1(struct net *net, struct socket *sock) | |||
| 641 | sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; | 637 | sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; |
| 642 | sk->sk_destruct = unix_sock_destructor; | 638 | sk->sk_destruct = unix_sock_destructor; |
| 643 | u = unix_sk(sk); | 639 | u = unix_sk(sk); |
| 644 | u->dentry = NULL; | 640 | u->path.dentry = NULL; |
| 645 | u->mnt = NULL; | 641 | u->path.mnt = NULL; |
| 646 | spin_lock_init(&u->lock); | 642 | spin_lock_init(&u->lock); |
| 647 | atomic_long_set(&u->inflight, 0); | 643 | atomic_long_set(&u->inflight, 0); |
| 648 | INIT_LIST_HEAD(&u->link); | 644 | INIT_LIST_HEAD(&u->link); |
| @@ -788,7 +784,7 @@ static struct sock *unix_find_other(struct net *net, | |||
| 788 | goto put_fail; | 784 | goto put_fail; |
| 789 | 785 | ||
| 790 | if (u->sk_type == type) | 786 | if (u->sk_type == type) |
| 791 | touch_atime(path.mnt, path.dentry); | 787 | touch_atime(&path); |
| 792 | 788 | ||
| 793 | path_put(&path); | 789 | path_put(&path); |
| 794 | 790 | ||
| @@ -802,9 +798,9 @@ static struct sock *unix_find_other(struct net *net, | |||
| 802 | u = unix_find_socket_byname(net, sunname, len, type, hash); | 798 | u = unix_find_socket_byname(net, sunname, len, type, hash); |
| 803 | if (u) { | 799 | if (u) { |
| 804 | struct dentry *dentry; | 800 | struct dentry *dentry; |
| 805 | dentry = unix_sk(u)->dentry; | 801 | dentry = unix_sk(u)->path.dentry; |
| 806 | if (dentry) | 802 | if (dentry) |
| 807 | touch_atime(unix_sk(u)->mnt, dentry); | 803 | touch_atime(&unix_sk(u)->path); |
| 808 | } else | 804 | } else |
| 809 | goto fail; | 805 | goto fail; |
| 810 | } | 806 | } |
| @@ -910,8 +906,7 @@ out_mknod_drop_write: | |||
| 910 | list = &unix_socket_table[addr->hash]; | 906 | list = &unix_socket_table[addr->hash]; |
| 911 | } else { | 907 | } else { |
| 912 | list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; | 908 | list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; |
| 913 | u->dentry = path.dentry; | 909 | u->path = path; |
| 914 | u->mnt = path.mnt; | ||
| 915 | } | 910 | } |
| 916 | 911 | ||
| 917 | err = 0; | 912 | err = 0; |
| @@ -1193,9 +1188,9 @@ restart: | |||
| 1193 | atomic_inc(&otheru->addr->refcnt); | 1188 | atomic_inc(&otheru->addr->refcnt); |
| 1194 | newu->addr = otheru->addr; | 1189 | newu->addr = otheru->addr; |
| 1195 | } | 1190 | } |
| 1196 | if (otheru->dentry) { | 1191 | if (otheru->path.dentry) { |
| 1197 | newu->dentry = dget(otheru->dentry); | 1192 | path_get(&otheru->path); |
| 1198 | newu->mnt = mntget(otheru->mnt); | 1193 | newu->path = otheru->path; |
| 1199 | } | 1194 | } |
| 1200 | 1195 | ||
| 1201 | /* Set credentials */ | 1196 | /* Set credentials */ |
