diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /net/unix/af_unix.c | |
parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 783317dacd30..dc504d308ec0 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1,15 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * NET4: Implementation of BSD Unix domain sockets. | 2 | * NET4: Implementation of BSD Unix domain sockets. |
3 | * | 3 | * |
4 | * Authors: Alan Cox, <alan.cox@linux.org> | 4 | * Authors: Alan Cox, <alan@lxorguk.ukuu.org.uk> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
8 | * as published by the Free Software Foundation; either version | 8 | * as published by the Free Software Foundation; either version |
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | * | 10 | * |
11 | * Version: $Id: af_unix.c,v 1.133 2002/02/08 03:57:19 davem Exp $ | ||
12 | * | ||
13 | * Fixes: | 11 | * Fixes: |
14 | * Linus Torvalds : Assorted bug cures. | 12 | * Linus Torvalds : Assorted bug cures. |
15 | * Niibe Yutaka : async I/O support. | 13 | * Niibe Yutaka : async I/O support. |
@@ -229,7 +227,7 @@ static void __unix_remove_socket(struct sock *sk) | |||
229 | 227 | ||
230 | static void __unix_insert_socket(struct hlist_head *list, struct sock *sk) | 228 | static void __unix_insert_socket(struct hlist_head *list, struct sock *sk) |
231 | { | 229 | { |
232 | BUG_TRAP(sk_unhashed(sk)); | 230 | WARN_ON(!sk_unhashed(sk)); |
233 | sk_add_node(sk, list); | 231 | sk_add_node(sk, list); |
234 | } | 232 | } |
235 | 233 | ||
@@ -352,9 +350,9 @@ static void unix_sock_destructor(struct sock *sk) | |||
352 | 350 | ||
353 | skb_queue_purge(&sk->sk_receive_queue); | 351 | skb_queue_purge(&sk->sk_receive_queue); |
354 | 352 | ||
355 | BUG_TRAP(!atomic_read(&sk->sk_wmem_alloc)); | 353 | WARN_ON(atomic_read(&sk->sk_wmem_alloc)); |
356 | BUG_TRAP(sk_unhashed(sk)); | 354 | WARN_ON(!sk_unhashed(sk)); |
357 | BUG_TRAP(!sk->sk_socket); | 355 | WARN_ON(sk->sk_socket); |
358 | if (!sock_flag(sk, SOCK_DEAD)) { | 356 | if (!sock_flag(sk, SOCK_DEAD)) { |
359 | printk("Attempt to release alive unix socket: %p\n", sk); | 357 | printk("Attempt to release alive unix socket: %p\n", sk); |
360 | return; | 358 | return; |
@@ -605,7 +603,7 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
605 | u->dentry = NULL; | 603 | u->dentry = NULL; |
606 | u->mnt = NULL; | 604 | u->mnt = NULL; |
607 | spin_lock_init(&u->lock); | 605 | spin_lock_init(&u->lock); |
608 | atomic_set(&u->inflight, 0); | 606 | atomic_long_set(&u->inflight, 0); |
609 | INIT_LIST_HEAD(&u->link); | 607 | INIT_LIST_HEAD(&u->link); |
610 | mutex_init(&u->readlock); /* single task reading lock */ | 608 | mutex_init(&u->readlock); /* single task reading lock */ |
611 | init_waitqueue_head(&u->peer_wait); | 609 | init_waitqueue_head(&u->peer_wait); |
@@ -713,28 +711,30 @@ static struct sock *unix_find_other(struct net *net, | |||
713 | int type, unsigned hash, int *error) | 711 | int type, unsigned hash, int *error) |
714 | { | 712 | { |
715 | struct sock *u; | 713 | struct sock *u; |
716 | struct nameidata nd; | 714 | struct path path; |
717 | int err = 0; | 715 | int err = 0; |
718 | 716 | ||
719 | if (sunname->sun_path[0]) { | 717 | if (sunname->sun_path[0]) { |
720 | err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd); | 718 | struct inode *inode; |
719 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); | ||
721 | if (err) | 720 | if (err) |
722 | goto fail; | 721 | goto fail; |
723 | err = vfs_permission(&nd, MAY_WRITE); | 722 | inode = path.dentry->d_inode; |
723 | err = inode_permission(inode, MAY_WRITE); | ||
724 | if (err) | 724 | if (err) |
725 | goto put_fail; | 725 | goto put_fail; |
726 | 726 | ||
727 | err = -ECONNREFUSED; | 727 | err = -ECONNREFUSED; |
728 | if (!S_ISSOCK(nd.path.dentry->d_inode->i_mode)) | 728 | if (!S_ISSOCK(inode->i_mode)) |
729 | goto put_fail; | 729 | goto put_fail; |
730 | u = unix_find_socket_byinode(net, nd.path.dentry->d_inode); | 730 | u = unix_find_socket_byinode(net, inode); |
731 | if (!u) | 731 | if (!u) |
732 | goto put_fail; | 732 | goto put_fail; |
733 | 733 | ||
734 | if (u->sk_type == type) | 734 | if (u->sk_type == type) |
735 | touch_atime(nd.path.mnt, nd.path.dentry); | 735 | touch_atime(path.mnt, path.dentry); |
736 | 736 | ||
737 | path_put(&nd.path); | 737 | path_put(&path); |
738 | 738 | ||
739 | err=-EPROTOTYPE; | 739 | err=-EPROTOTYPE; |
740 | if (u->sk_type != type) { | 740 | if (u->sk_type != type) { |
@@ -755,7 +755,7 @@ static struct sock *unix_find_other(struct net *net, | |||
755 | return u; | 755 | return u; |
756 | 756 | ||
757 | put_fail: | 757 | put_fail: |
758 | path_put(&nd.path); | 758 | path_put(&path); |
759 | fail: | 759 | fail: |
760 | *error=err; | 760 | *error=err; |
761 | return NULL; | 761 | return NULL; |