diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-12 14:12:06 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-12 14:12:06 -0500 |
| commit | e697b8d13ede3893724898d983eff3f8c9183643 (patch) | |
| tree | 0144d2d98d33e92a1d93739f0db12997c000d456 /net/unix/af_unix.c | |
| parent | 46015977e70f672ae6b20a1b5fb1e361208365ba (diff) | |
| parent | 2994c63863ac350c4c8c6a65d8110749c2abb95c (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (39 commits)
[INET]: Small possible memory leak in FIB rules
[NETNS]: init dev_base_lock only once
[UNIX]: The unix_nr_socks limit can be exceeded
[AF_UNIX]: Convert socks to unix_socks in scan_inflight, not in callbacks
[AF_UNIX]: Make unix_tot_inflight counter non-atomic
[AF_PACKET]: Allow multicast traffic to be caught by ORIGDEV when bonded
ssb: Fix PCMCIA-host lowlevel bus access
mac80211: fix MAC80211_RCSIMPLE Kconfig
mac80211: make "decrypt failed" messages conditional upon MAC80211_DEBUG
mac80211: use IW_AUTH_PRIVACY_INVOKED rather than IW_AUTH_KEY_MGMT
mac80211: remove unused driver ops
mac80211: remove ieee80211_common.h
softmac: MAINTAINERS update
rfkill: Fix sparse warning
rfkill: Use mutex_lock() at register and add sanity check
iwlwifi: select proper rate control algorithm
mac80211: allow driver to ask for a rate control algorithm
mac80211: don't allow registering the same rate control twice
rfkill: Use subsys_initcall
mac80211: make simple rate control algorithm built-in
...
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 515e7a692f9b..e835da8fc091 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -457,7 +457,7 @@ static int unix_release_sock (struct sock *sk, int embrion) | |||
| 457 | * What the above comment does talk about? --ANK(980817) | 457 | * What the above comment does talk about? --ANK(980817) |
| 458 | */ | 458 | */ |
| 459 | 459 | ||
| 460 | if (atomic_read(&unix_tot_inflight)) | 460 | if (unix_tot_inflight) |
| 461 | unix_gc(); /* Garbage collect fds */ | 461 | unix_gc(); /* Garbage collect fds */ |
| 462 | 462 | ||
| 463 | return 0; | 463 | return 0; |
| @@ -599,15 +599,14 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
| 599 | struct sock *sk = NULL; | 599 | struct sock *sk = NULL; |
| 600 | struct unix_sock *u; | 600 | struct unix_sock *u; |
| 601 | 601 | ||
| 602 | if (atomic_read(&unix_nr_socks) >= 2*get_max_files()) | 602 | atomic_inc(&unix_nr_socks); |
| 603 | if (atomic_read(&unix_nr_socks) > 2 * get_max_files()) | ||
| 603 | goto out; | 604 | goto out; |
| 604 | 605 | ||
| 605 | sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto); | 606 | sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto); |
| 606 | if (!sk) | 607 | if (!sk) |
| 607 | goto out; | 608 | goto out; |
| 608 | 609 | ||
| 609 | atomic_inc(&unix_nr_socks); | ||
| 610 | |||
| 611 | sock_init_data(sock,sk); | 610 | sock_init_data(sock,sk); |
| 612 | lockdep_set_class(&sk->sk_receive_queue.lock, | 611 | lockdep_set_class(&sk->sk_receive_queue.lock, |
| 613 | &af_unix_sk_receive_queue_lock_key); | 612 | &af_unix_sk_receive_queue_lock_key); |
| @@ -625,6 +624,8 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
| 625 | init_waitqueue_head(&u->peer_wait); | 624 | init_waitqueue_head(&u->peer_wait); |
| 626 | unix_insert_socket(unix_sockets_unbound, sk); | 625 | unix_insert_socket(unix_sockets_unbound, sk); |
| 627 | out: | 626 | out: |
| 627 | if (sk == NULL) | ||
| 628 | atomic_dec(&unix_nr_socks); | ||
| 628 | return sk; | 629 | return sk; |
| 629 | } | 630 | } |
| 630 | 631 | ||
