X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Funix%2Faf_unix.c;h=e835da8fc09184f8e2dddcba9c471922af1b1165;hb=1f305323ff5b9ddc1a4346d36072bcdb58f3f68a;hp=515e7a692f9bf85e263bf5a8752c22f0384595d0;hpb=aac9e28d2f3d3c1eacc4114d685864a2a6423b80;p=linux-2.6-omap-h63xx.git diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 515e7a692f9..e835da8fc09 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) * What the above comment does talk about? --ANK(980817) */ - if (atomic_read(&unix_tot_inflight)) + if (unix_tot_inflight) unix_gc(); /* Garbage collect fds */ return 0; @@ -599,15 +599,14 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) struct sock *sk = NULL; struct unix_sock *u; - if (atomic_read(&unix_nr_socks) >= 2*get_max_files()) + atomic_inc(&unix_nr_socks); + if (atomic_read(&unix_nr_socks) > 2 * get_max_files()) goto out; sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto); if (!sk) goto out; - atomic_inc(&unix_nr_socks); - sock_init_data(sock,sk); lockdep_set_class(&sk->sk_receive_queue.lock, &af_unix_sk_receive_queue_lock_key); @@ -625,6 +624,8 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) init_waitqueue_head(&u->peer_wait); unix_insert_socket(unix_sockets_unbound, sk); out: + if (sk == NULL) + atomic_dec(&unix_nr_socks); return sk; }