diff options
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 200 | ||||
-rw-r--r-- | net/unix/garbage.c | 12 | ||||
-rw-r--r-- | net/unix/sysctl_net_unix.c | 3 |
3 files changed, 107 insertions, 108 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 66d5ac4773ab..92f52abd3515 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -164,7 +164,7 @@ static inline int unix_our_peer(struct sock *sk, struct sock *osk) | |||
164 | 164 | ||
165 | static inline int unix_may_send(struct sock *sk, struct sock *osk) | 165 | static inline int unix_may_send(struct sock *sk, struct sock *osk) |
166 | { | 166 | { |
167 | return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); | 167 | return unix_peer(osk) == NULL || unix_our_peer(sk, osk); |
168 | } | 168 | } |
169 | 169 | ||
170 | static inline int unix_recvq_full(struct sock const *sk) | 170 | static inline int unix_recvq_full(struct sock const *sk) |
@@ -197,7 +197,7 @@ static inline void unix_release_addr(struct unix_address *addr) | |||
197 | * - if started by zero, it is abstract name. | 197 | * - if started by zero, it is abstract name. |
198 | */ | 198 | */ |
199 | 199 | ||
200 | static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp) | 200 | static int unix_mkname(struct sockaddr_un *sunaddr, int len, unsigned *hashp) |
201 | { | 201 | { |
202 | if (len <= sizeof(short) || len > sizeof(*sunaddr)) | 202 | if (len <= sizeof(short) || len > sizeof(*sunaddr)) |
203 | return -EINVAL; | 203 | return -EINVAL; |
@@ -211,12 +211,12 @@ static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp) | |||
211 | * we are guaranteed that it is a valid memory location in our | 211 | * we are guaranteed that it is a valid memory location in our |
212 | * kernel address buffer. | 212 | * kernel address buffer. |
213 | */ | 213 | */ |
214 | ((char *)sunaddr)[len]=0; | 214 | ((char *)sunaddr)[len] = 0; |
215 | len = strlen(sunaddr->sun_path)+1+sizeof(short); | 215 | len = strlen(sunaddr->sun_path)+1+sizeof(short); |
216 | return len; | 216 | return len; |
217 | } | 217 | } |
218 | 218 | ||
219 | *hashp = unix_hash_fold(csum_partial((char*)sunaddr, len, 0)); | 219 | *hashp = unix_hash_fold(csum_partial(sunaddr, len, 0)); |
220 | return len; | 220 | return len; |
221 | } | 221 | } |
222 | 222 | ||
@@ -295,8 +295,7 @@ static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i) | |||
295 | if (!net_eq(sock_net(s), net)) | 295 | if (!net_eq(sock_net(s), net)) |
296 | continue; | 296 | continue; |
297 | 297 | ||
298 | if(dentry && dentry->d_inode == i) | 298 | if (dentry && dentry->d_inode == i) { |
299 | { | ||
300 | sock_hold(s); | 299 | sock_hold(s); |
301 | goto found; | 300 | goto found; |
302 | } | 301 | } |
@@ -354,7 +353,7 @@ static void unix_sock_destructor(struct sock *sk) | |||
354 | WARN_ON(!sk_unhashed(sk)); | 353 | WARN_ON(!sk_unhashed(sk)); |
355 | WARN_ON(sk->sk_socket); | 354 | WARN_ON(sk->sk_socket); |
356 | if (!sock_flag(sk, SOCK_DEAD)) { | 355 | if (!sock_flag(sk, SOCK_DEAD)) { |
357 | printk("Attempt to release alive unix socket: %p\n", sk); | 356 | printk(KERN_INFO "Attempt to release alive unix socket: %p\n", sk); |
358 | return; | 357 | return; |
359 | } | 358 | } |
360 | 359 | ||
@@ -362,12 +361,16 @@ static void unix_sock_destructor(struct sock *sk) | |||
362 | unix_release_addr(u->addr); | 361 | unix_release_addr(u->addr); |
363 | 362 | ||
364 | atomic_dec(&unix_nr_socks); | 363 | atomic_dec(&unix_nr_socks); |
364 | local_bh_disable(); | ||
365 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); | ||
366 | local_bh_enable(); | ||
365 | #ifdef UNIX_REFCNT_DEBUG | 367 | #ifdef UNIX_REFCNT_DEBUG |
366 | printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk, atomic_read(&unix_nr_socks)); | 368 | printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk, |
369 | atomic_read(&unix_nr_socks)); | ||
367 | #endif | 370 | #endif |
368 | } | 371 | } |
369 | 372 | ||
370 | static int unix_release_sock (struct sock *sk, int embrion) | 373 | static int unix_release_sock(struct sock *sk, int embrion) |
371 | { | 374 | { |
372 | struct unix_sock *u = unix_sk(sk); | 375 | struct unix_sock *u = unix_sk(sk); |
373 | struct dentry *dentry; | 376 | struct dentry *dentry; |
@@ -392,9 +395,9 @@ static int unix_release_sock (struct sock *sk, int embrion) | |||
392 | 395 | ||
393 | wake_up_interruptible_all(&u->peer_wait); | 396 | wake_up_interruptible_all(&u->peer_wait); |
394 | 397 | ||
395 | skpair=unix_peer(sk); | 398 | skpair = unix_peer(sk); |
396 | 399 | ||
397 | if (skpair!=NULL) { | 400 | if (skpair != NULL) { |
398 | if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { | 401 | if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { |
399 | unix_state_lock(skpair); | 402 | unix_state_lock(skpair); |
400 | /* No more writes */ | 403 | /* No more writes */ |
@@ -414,7 +417,7 @@ static int unix_release_sock (struct sock *sk, int embrion) | |||
414 | /* Try to flush out this socket. Throw out buffers at least */ | 417 | /* Try to flush out this socket. Throw out buffers at least */ |
415 | 418 | ||
416 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { | 419 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { |
417 | if (state==TCP_LISTEN) | 420 | if (state == TCP_LISTEN) |
418 | unix_release_sock(skb->sk, 1); | 421 | unix_release_sock(skb->sk, 1); |
419 | /* passed fds are erased in the kfree_skb hook */ | 422 | /* passed fds are erased in the kfree_skb hook */ |
420 | kfree_skb(skb); | 423 | kfree_skb(skb); |
@@ -453,11 +456,11 @@ static int unix_listen(struct socket *sock, int backlog) | |||
453 | struct unix_sock *u = unix_sk(sk); | 456 | struct unix_sock *u = unix_sk(sk); |
454 | 457 | ||
455 | err = -EOPNOTSUPP; | 458 | err = -EOPNOTSUPP; |
456 | if (sock->type!=SOCK_STREAM && sock->type!=SOCK_SEQPACKET) | 459 | if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) |
457 | goto out; /* Only stream/seqpacket sockets accept */ | 460 | goto out; /* Only stream/seqpacket sockets accept */ |
458 | err = -EINVAL; | 461 | err = -EINVAL; |
459 | if (!u->addr) | 462 | if (!u->addr) |
460 | goto out; /* No listens on an unbound socket */ | 463 | goto out; /* No listens on an unbound socket */ |
461 | unix_state_lock(sk); | 464 | unix_state_lock(sk); |
462 | if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN) | 465 | if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN) |
463 | goto out_unlock; | 466 | goto out_unlock; |
@@ -566,9 +569,9 @@ static const struct proto_ops unix_seqpacket_ops = { | |||
566 | }; | 569 | }; |
567 | 570 | ||
568 | static struct proto unix_proto = { | 571 | static struct proto unix_proto = { |
569 | .name = "UNIX", | 572 | .name = "UNIX", |
570 | .owner = THIS_MODULE, | 573 | .owner = THIS_MODULE, |
571 | .obj_size = sizeof(struct unix_sock), | 574 | .obj_size = sizeof(struct unix_sock), |
572 | }; | 575 | }; |
573 | 576 | ||
574 | /* | 577 | /* |
@@ -579,7 +582,7 @@ static struct proto unix_proto = { | |||
579 | */ | 582 | */ |
580 | static struct lock_class_key af_unix_sk_receive_queue_lock_key; | 583 | static struct lock_class_key af_unix_sk_receive_queue_lock_key; |
581 | 584 | ||
582 | static struct sock * unix_create1(struct net *net, struct socket *sock) | 585 | static struct sock *unix_create1(struct net *net, struct socket *sock) |
583 | { | 586 | { |
584 | struct sock *sk = NULL; | 587 | struct sock *sk = NULL; |
585 | struct unix_sock *u; | 588 | struct unix_sock *u; |
@@ -592,7 +595,7 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
592 | if (!sk) | 595 | if (!sk) |
593 | goto out; | 596 | goto out; |
594 | 597 | ||
595 | sock_init_data(sock,sk); | 598 | sock_init_data(sock, sk); |
596 | lockdep_set_class(&sk->sk_receive_queue.lock, | 599 | lockdep_set_class(&sk->sk_receive_queue.lock, |
597 | &af_unix_sk_receive_queue_lock_key); | 600 | &af_unix_sk_receive_queue_lock_key); |
598 | 601 | ||
@@ -611,6 +614,11 @@ static struct sock * unix_create1(struct net *net, struct socket *sock) | |||
611 | out: | 614 | out: |
612 | if (sk == NULL) | 615 | if (sk == NULL) |
613 | atomic_dec(&unix_nr_socks); | 616 | atomic_dec(&unix_nr_socks); |
617 | else { | ||
618 | local_bh_disable(); | ||
619 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | ||
620 | local_bh_enable(); | ||
621 | } | ||
614 | return sk; | 622 | return sk; |
615 | } | 623 | } |
616 | 624 | ||
@@ -630,7 +638,7 @@ static int unix_create(struct net *net, struct socket *sock, int protocol) | |||
630 | * nothing uses it. | 638 | * nothing uses it. |
631 | */ | 639 | */ |
632 | case SOCK_RAW: | 640 | case SOCK_RAW: |
633 | sock->type=SOCK_DGRAM; | 641 | sock->type = SOCK_DGRAM; |
634 | case SOCK_DGRAM: | 642 | case SOCK_DGRAM: |
635 | sock->ops = &unix_dgram_ops; | 643 | sock->ops = &unix_dgram_ops; |
636 | break; | 644 | break; |
@@ -653,7 +661,7 @@ static int unix_release(struct socket *sock) | |||
653 | 661 | ||
654 | sock->sk = NULL; | 662 | sock->sk = NULL; |
655 | 663 | ||
656 | return unix_release_sock (sk, 0); | 664 | return unix_release_sock(sk, 0); |
657 | } | 665 | } |
658 | 666 | ||
659 | static int unix_autobind(struct socket *sock) | 667 | static int unix_autobind(struct socket *sock) |
@@ -662,7 +670,7 @@ static int unix_autobind(struct socket *sock) | |||
662 | struct net *net = sock_net(sk); | 670 | struct net *net = sock_net(sk); |
663 | struct unix_sock *u = unix_sk(sk); | 671 | struct unix_sock *u = unix_sk(sk); |
664 | static u32 ordernum = 1; | 672 | static u32 ordernum = 1; |
665 | struct unix_address * addr; | 673 | struct unix_address *addr; |
666 | int err; | 674 | int err; |
667 | 675 | ||
668 | mutex_lock(&u->readlock); | 676 | mutex_lock(&u->readlock); |
@@ -681,7 +689,7 @@ static int unix_autobind(struct socket *sock) | |||
681 | 689 | ||
682 | retry: | 690 | retry: |
683 | addr->len = sprintf(addr->name->sun_path+1, "%05x", ordernum) + 1 + sizeof(short); | 691 | addr->len = sprintf(addr->name->sun_path+1, "%05x", ordernum) + 1 + sizeof(short); |
684 | addr->hash = unix_hash_fold(csum_partial((void*)addr->name, addr->len, 0)); | 692 | addr->hash = unix_hash_fold(csum_partial(addr->name, addr->len, 0)); |
685 | 693 | ||
686 | spin_lock(&unix_table_lock); | 694 | spin_lock(&unix_table_lock); |
687 | ordernum = (ordernum+1)&0xFFFFF; | 695 | ordernum = (ordernum+1)&0xFFFFF; |
@@ -736,14 +744,14 @@ static struct sock *unix_find_other(struct net *net, | |||
736 | 744 | ||
737 | path_put(&path); | 745 | path_put(&path); |
738 | 746 | ||
739 | err=-EPROTOTYPE; | 747 | err = -EPROTOTYPE; |
740 | if (u->sk_type != type) { | 748 | if (u->sk_type != type) { |
741 | sock_put(u); | 749 | sock_put(u); |
742 | goto fail; | 750 | goto fail; |
743 | } | 751 | } |
744 | } else { | 752 | } else { |
745 | err = -ECONNREFUSED; | 753 | err = -ECONNREFUSED; |
746 | u=unix_find_socket_byname(net, sunname, len, type, hash); | 754 | u = unix_find_socket_byname(net, sunname, len, type, hash); |
747 | if (u) { | 755 | if (u) { |
748 | struct dentry *dentry; | 756 | struct dentry *dentry; |
749 | dentry = unix_sk(u)->dentry; | 757 | dentry = unix_sk(u)->dentry; |
@@ -757,7 +765,7 @@ static struct sock *unix_find_other(struct net *net, | |||
757 | put_fail: | 765 | put_fail: |
758 | path_put(&path); | 766 | path_put(&path); |
759 | fail: | 767 | fail: |
760 | *error=err; | 768 | *error = err; |
761 | return NULL; | 769 | return NULL; |
762 | } | 770 | } |
763 | 771 | ||
@@ -767,8 +775,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
767 | struct sock *sk = sock->sk; | 775 | struct sock *sk = sock->sk; |
768 | struct net *net = sock_net(sk); | 776 | struct net *net = sock_net(sk); |
769 | struct unix_sock *u = unix_sk(sk); | 777 | struct unix_sock *u = unix_sk(sk); |
770 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 778 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
771 | struct dentry * dentry = NULL; | 779 | struct dentry *dentry = NULL; |
772 | struct nameidata nd; | 780 | struct nameidata nd; |
773 | int err; | 781 | int err; |
774 | unsigned hash; | 782 | unsigned hash; |
@@ -779,7 +787,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
779 | if (sunaddr->sun_family != AF_UNIX) | 787 | if (sunaddr->sun_family != AF_UNIX) |
780 | goto out; | 788 | goto out; |
781 | 789 | ||
782 | if (addr_len==sizeof(short)) { | 790 | if (addr_len == sizeof(short)) { |
783 | err = unix_autobind(sock); | 791 | err = unix_autobind(sock); |
784 | goto out; | 792 | goto out; |
785 | } | 793 | } |
@@ -875,8 +883,8 @@ out_mknod_unlock: | |||
875 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 883 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); |
876 | path_put(&nd.path); | 884 | path_put(&nd.path); |
877 | out_mknod_parent: | 885 | out_mknod_parent: |
878 | if (err==-EEXIST) | 886 | if (err == -EEXIST) |
879 | err=-EADDRINUSE; | 887 | err = -EADDRINUSE; |
880 | unix_release_addr(addr); | 888 | unix_release_addr(addr); |
881 | goto out_up; | 889 | goto out_up; |
882 | } | 890 | } |
@@ -911,7 +919,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, | |||
911 | { | 919 | { |
912 | struct sock *sk = sock->sk; | 920 | struct sock *sk = sock->sk; |
913 | struct net *net = sock_net(sk); | 921 | struct net *net = sock_net(sk); |
914 | struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr; | 922 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr; |
915 | struct sock *other; | 923 | struct sock *other; |
916 | unsigned hash; | 924 | unsigned hash; |
917 | int err; | 925 | int err; |
@@ -927,7 +935,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, | |||
927 | goto out; | 935 | goto out; |
928 | 936 | ||
929 | restart: | 937 | restart: |
930 | other=unix_find_other(net, sunaddr, alen, sock->type, hash, &err); | 938 | other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); |
931 | if (!other) | 939 | if (!other) |
932 | goto out; | 940 | goto out; |
933 | 941 | ||
@@ -961,14 +969,14 @@ restart: | |||
961 | */ | 969 | */ |
962 | if (unix_peer(sk)) { | 970 | if (unix_peer(sk)) { |
963 | struct sock *old_peer = unix_peer(sk); | 971 | struct sock *old_peer = unix_peer(sk); |
964 | unix_peer(sk)=other; | 972 | unix_peer(sk) = other; |
965 | unix_state_double_unlock(sk, other); | 973 | unix_state_double_unlock(sk, other); |
966 | 974 | ||
967 | if (other != old_peer) | 975 | if (other != old_peer) |
968 | unix_dgram_disconnected(sk, old_peer); | 976 | unix_dgram_disconnected(sk, old_peer); |
969 | sock_put(old_peer); | 977 | sock_put(old_peer); |
970 | } else { | 978 | } else { |
971 | unix_peer(sk)=other; | 979 | unix_peer(sk) = other; |
972 | unix_state_double_unlock(sk, other); | 980 | unix_state_double_unlock(sk, other); |
973 | } | 981 | } |
974 | return 0; | 982 | return 0; |
@@ -1004,7 +1012,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo) | |||
1004 | static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, | 1012 | static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, |
1005 | int addr_len, int flags) | 1013 | int addr_len, int flags) |
1006 | { | 1014 | { |
1007 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 1015 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
1008 | struct sock *sk = sock->sk; | 1016 | struct sock *sk = sock->sk; |
1009 | struct net *net = sock_net(sk); | 1017 | struct net *net = sock_net(sk); |
1010 | struct unix_sock *u = unix_sk(sk), *newu, *otheru; | 1018 | struct unix_sock *u = unix_sk(sk), *newu, *otheru; |
@@ -1179,13 +1187,13 @@ out: | |||
1179 | 1187 | ||
1180 | static int unix_socketpair(struct socket *socka, struct socket *sockb) | 1188 | static int unix_socketpair(struct socket *socka, struct socket *sockb) |
1181 | { | 1189 | { |
1182 | struct sock *ska=socka->sk, *skb = sockb->sk; | 1190 | struct sock *ska = socka->sk, *skb = sockb->sk; |
1183 | 1191 | ||
1184 | /* Join our sockets back to back */ | 1192 | /* Join our sockets back to back */ |
1185 | sock_hold(ska); | 1193 | sock_hold(ska); |
1186 | sock_hold(skb); | 1194 | sock_hold(skb); |
1187 | unix_peer(ska)=skb; | 1195 | unix_peer(ska) = skb; |
1188 | unix_peer(skb)=ska; | 1196 | unix_peer(skb) = ska; |
1189 | ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current); | 1197 | ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current); |
1190 | ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid; | 1198 | ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid; |
1191 | ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid; | 1199 | ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid; |
@@ -1207,7 +1215,7 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags) | |||
1207 | int err; | 1215 | int err; |
1208 | 1216 | ||
1209 | err = -EOPNOTSUPP; | 1217 | err = -EOPNOTSUPP; |
1210 | if (sock->type!=SOCK_STREAM && sock->type!=SOCK_SEQPACKET) | 1218 | if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) |
1211 | goto out; | 1219 | goto out; |
1212 | 1220 | ||
1213 | err = -EINVAL; | 1221 | err = -EINVAL; |
@@ -1246,7 +1254,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_ | |||
1246 | { | 1254 | { |
1247 | struct sock *sk = sock->sk; | 1255 | struct sock *sk = sock->sk; |
1248 | struct unix_sock *u; | 1256 | struct unix_sock *u; |
1249 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 1257 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
1250 | int err = 0; | 1258 | int err = 0; |
1251 | 1259 | ||
1252 | if (peer) { | 1260 | if (peer) { |
@@ -1286,7 +1294,7 @@ static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
1286 | skb->destructor = sock_wfree; | 1294 | skb->destructor = sock_wfree; |
1287 | UNIXCB(skb).fp = NULL; | 1295 | UNIXCB(skb).fp = NULL; |
1288 | 1296 | ||
1289 | for (i=scm->fp->count-1; i>=0; i--) | 1297 | for (i = scm->fp->count-1; i >= 0; i--) |
1290 | unix_notinflight(scm->fp->fp[i]); | 1298 | unix_notinflight(scm->fp->fp[i]); |
1291 | } | 1299 | } |
1292 | 1300 | ||
@@ -1315,7 +1323,7 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
1315 | if (!UNIXCB(skb).fp) | 1323 | if (!UNIXCB(skb).fp) |
1316 | return -ENOMEM; | 1324 | return -ENOMEM; |
1317 | 1325 | ||
1318 | for (i=scm->fp->count-1; i>=0; i--) | 1326 | for (i = scm->fp->count-1; i >= 0; i--) |
1319 | unix_inflight(scm->fp->fp[i]); | 1327 | unix_inflight(scm->fp->fp[i]); |
1320 | skb->destructor = unix_destruct_fds; | 1328 | skb->destructor = unix_destruct_fds; |
1321 | return 0; | 1329 | return 0; |
@@ -1332,7 +1340,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1332 | struct sock *sk = sock->sk; | 1340 | struct sock *sk = sock->sk; |
1333 | struct net *net = sock_net(sk); | 1341 | struct net *net = sock_net(sk); |
1334 | struct unix_sock *u = unix_sk(sk); | 1342 | struct unix_sock *u = unix_sk(sk); |
1335 | struct sockaddr_un *sunaddr=msg->msg_name; | 1343 | struct sockaddr_un *sunaddr = msg->msg_name; |
1336 | struct sock *other = NULL; | 1344 | struct sock *other = NULL; |
1337 | int namelen = 0; /* fake GCC */ | 1345 | int namelen = 0; /* fake GCC */ |
1338 | int err; | 1346 | int err; |
@@ -1374,7 +1382,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1374 | goto out; | 1382 | goto out; |
1375 | 1383 | ||
1376 | skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); | 1384 | skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); |
1377 | if (skb==NULL) | 1385 | if (skb == NULL) |
1378 | goto out; | 1386 | goto out; |
1379 | 1387 | ||
1380 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); | 1388 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); |
@@ -1386,7 +1394,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1386 | unix_get_secdata(siocb->scm, skb); | 1394 | unix_get_secdata(siocb->scm, skb); |
1387 | 1395 | ||
1388 | skb_reset_transport_header(skb); | 1396 | skb_reset_transport_header(skb); |
1389 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); | 1397 | err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); |
1390 | if (err) | 1398 | if (err) |
1391 | goto out_free; | 1399 | goto out_free; |
1392 | 1400 | ||
@@ -1400,7 +1408,7 @@ restart: | |||
1400 | 1408 | ||
1401 | other = unix_find_other(net, sunaddr, namelen, sk->sk_type, | 1409 | other = unix_find_other(net, sunaddr, namelen, sk->sk_type, |
1402 | hash, &err); | 1410 | hash, &err); |
1403 | if (other==NULL) | 1411 | if (other == NULL) |
1404 | goto out_free; | 1412 | goto out_free; |
1405 | } | 1413 | } |
1406 | 1414 | ||
@@ -1420,7 +1428,7 @@ restart: | |||
1420 | err = 0; | 1428 | err = 0; |
1421 | unix_state_lock(sk); | 1429 | unix_state_lock(sk); |
1422 | if (unix_peer(sk) == other) { | 1430 | if (unix_peer(sk) == other) { |
1423 | unix_peer(sk)=NULL; | 1431 | unix_peer(sk) = NULL; |
1424 | unix_state_unlock(sk); | 1432 | unix_state_unlock(sk); |
1425 | 1433 | ||
1426 | unix_dgram_disconnected(sk, other); | 1434 | unix_dgram_disconnected(sk, other); |
@@ -1486,10 +1494,10 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1486 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); | 1494 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); |
1487 | struct sock *sk = sock->sk; | 1495 | struct sock *sk = sock->sk; |
1488 | struct sock *other = NULL; | 1496 | struct sock *other = NULL; |
1489 | struct sockaddr_un *sunaddr=msg->msg_name; | 1497 | struct sockaddr_un *sunaddr = msg->msg_name; |
1490 | int err,size; | 1498 | int err, size; |
1491 | struct sk_buff *skb; | 1499 | struct sk_buff *skb; |
1492 | int sent=0; | 1500 | int sent = 0; |
1493 | struct scm_cookie tmp_scm; | 1501 | struct scm_cookie tmp_scm; |
1494 | 1502 | ||
1495 | if (NULL == siocb->scm) | 1503 | if (NULL == siocb->scm) |
@@ -1517,8 +1525,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1517 | if (sk->sk_shutdown & SEND_SHUTDOWN) | 1525 | if (sk->sk_shutdown & SEND_SHUTDOWN) |
1518 | goto pipe_err; | 1526 | goto pipe_err; |
1519 | 1527 | ||
1520 | while(sent < len) | 1528 | while (sent < len) { |
1521 | { | ||
1522 | /* | 1529 | /* |
1523 | * Optimisation for the fact that under 0.01% of X | 1530 | * Optimisation for the fact that under 0.01% of X |
1524 | * messages typically need breaking up. | 1531 | * messages typically need breaking up. |
@@ -1537,9 +1544,10 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1537 | * Grab a buffer | 1544 | * Grab a buffer |
1538 | */ | 1545 | */ |
1539 | 1546 | ||
1540 | skb=sock_alloc_send_skb(sk,size,msg->msg_flags&MSG_DONTWAIT, &err); | 1547 | skb = sock_alloc_send_skb(sk, size, msg->msg_flags&MSG_DONTWAIT, |
1548 | &err); | ||
1541 | 1549 | ||
1542 | if (skb==NULL) | 1550 | if (skb == NULL) |
1543 | goto out_err; | 1551 | goto out_err; |
1544 | 1552 | ||
1545 | /* | 1553 | /* |
@@ -1560,7 +1568,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1560 | } | 1568 | } |
1561 | } | 1569 | } |
1562 | 1570 | ||
1563 | if ((err = memcpy_fromiovec(skb_put(skb,size), msg->msg_iov, size)) != 0) { | 1571 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); |
1572 | if (err) { | ||
1564 | kfree_skb(skb); | 1573 | kfree_skb(skb); |
1565 | goto out_err; | 1574 | goto out_err; |
1566 | } | 1575 | } |
@@ -1574,7 +1583,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1574 | skb_queue_tail(&other->sk_receive_queue, skb); | 1583 | skb_queue_tail(&other->sk_receive_queue, skb); |
1575 | unix_state_unlock(other); | 1584 | unix_state_unlock(other); |
1576 | other->sk_data_ready(other, size); | 1585 | other->sk_data_ready(other, size); |
1577 | sent+=size; | 1586 | sent += size; |
1578 | } | 1587 | } |
1579 | 1588 | ||
1580 | scm_destroy(siocb->scm); | 1589 | scm_destroy(siocb->scm); |
@@ -1586,8 +1595,8 @@ pipe_err_free: | |||
1586 | unix_state_unlock(other); | 1595 | unix_state_unlock(other); |
1587 | kfree_skb(skb); | 1596 | kfree_skb(skb); |
1588 | pipe_err: | 1597 | pipe_err: |
1589 | if (sent==0 && !(msg->msg_flags&MSG_NOSIGNAL)) | 1598 | if (sent == 0 && !(msg->msg_flags&MSG_NOSIGNAL)) |
1590 | send_sig(SIGPIPE,current,0); | 1599 | send_sig(SIGPIPE, current, 0); |
1591 | err = -EPIPE; | 1600 | err = -EPIPE; |
1592 | out_err: | 1601 | out_err: |
1593 | scm_destroy(siocb->scm); | 1602 | scm_destroy(siocb->scm); |
@@ -1677,13 +1686,10 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1677 | siocb->scm->creds = *UNIXCREDS(skb); | 1686 | siocb->scm->creds = *UNIXCREDS(skb); |
1678 | unix_set_secdata(siocb->scm, skb); | 1687 | unix_set_secdata(siocb->scm, skb); |
1679 | 1688 | ||
1680 | if (!(flags & MSG_PEEK)) | 1689 | if (!(flags & MSG_PEEK)) { |
1681 | { | ||
1682 | if (UNIXCB(skb).fp) | 1690 | if (UNIXCB(skb).fp) |
1683 | unix_detach_fds(siocb->scm, skb); | 1691 | unix_detach_fds(siocb->scm, skb); |
1684 | } | 1692 | } else { |
1685 | else | ||
1686 | { | ||
1687 | /* It is questionable: on PEEK we could: | 1693 | /* It is questionable: on PEEK we could: |
1688 | - do not return fds - good, but too simple 8) | 1694 | - do not return fds - good, but too simple 8) |
1689 | - return fds, and do not return them on read (old strategy, | 1695 | - return fds, and do not return them on read (old strategy, |
@@ -1704,7 +1710,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1704 | scm_recv(sock, msg, siocb->scm, flags); | 1710 | scm_recv(sock, msg, siocb->scm, flags); |
1705 | 1711 | ||
1706 | out_free: | 1712 | out_free: |
1707 | skb_free_datagram(sk,skb); | 1713 | skb_free_datagram(sk, skb); |
1708 | out_unlock: | 1714 | out_unlock: |
1709 | mutex_unlock(&u->readlock); | 1715 | mutex_unlock(&u->readlock); |
1710 | out: | 1716 | out: |
@@ -1715,7 +1721,7 @@ out: | |||
1715 | * Sleep until data has arrive. But check for races.. | 1721 | * Sleep until data has arrive. But check for races.. |
1716 | */ | 1722 | */ |
1717 | 1723 | ||
1718 | static long unix_stream_data_wait(struct sock * sk, long timeo) | 1724 | static long unix_stream_data_wait(struct sock *sk, long timeo) |
1719 | { | 1725 | { |
1720 | DEFINE_WAIT(wait); | 1726 | DEFINE_WAIT(wait); |
1721 | 1727 | ||
@@ -1753,7 +1759,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1753 | struct scm_cookie tmp_scm; | 1759 | struct scm_cookie tmp_scm; |
1754 | struct sock *sk = sock->sk; | 1760 | struct sock *sk = sock->sk; |
1755 | struct unix_sock *u = unix_sk(sk); | 1761 | struct unix_sock *u = unix_sk(sk); |
1756 | struct sockaddr_un *sunaddr=msg->msg_name; | 1762 | struct sockaddr_un *sunaddr = msg->msg_name; |
1757 | int copied = 0; | 1763 | int copied = 0; |
1758 | int check_creds = 0; | 1764 | int check_creds = 0; |
1759 | int target; | 1765 | int target; |
@@ -1784,15 +1790,13 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1784 | 1790 | ||
1785 | mutex_lock(&u->readlock); | 1791 | mutex_lock(&u->readlock); |
1786 | 1792 | ||
1787 | do | 1793 | do { |
1788 | { | ||
1789 | int chunk; | 1794 | int chunk; |
1790 | struct sk_buff *skb; | 1795 | struct sk_buff *skb; |
1791 | 1796 | ||
1792 | unix_state_lock(sk); | 1797 | unix_state_lock(sk); |
1793 | skb = skb_dequeue(&sk->sk_receive_queue); | 1798 | skb = skb_dequeue(&sk->sk_receive_queue); |
1794 | if (skb==NULL) | 1799 | if (skb == NULL) { |
1795 | { | ||
1796 | if (copied >= target) | 1800 | if (copied >= target) |
1797 | goto unlock; | 1801 | goto unlock; |
1798 | 1802 | ||
@@ -1800,7 +1804,8 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1800 | * POSIX 1003.1g mandates this order. | 1804 | * POSIX 1003.1g mandates this order. |
1801 | */ | 1805 | */ |
1802 | 1806 | ||
1803 | if ((err = sock_error(sk)) != 0) | 1807 | err = sock_error(sk); |
1808 | if (err) | ||
1804 | goto unlock; | 1809 | goto unlock; |
1805 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 1810 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
1806 | goto unlock; | 1811 | goto unlock; |
@@ -1827,7 +1832,8 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1827 | 1832 | ||
1828 | if (check_creds) { | 1833 | if (check_creds) { |
1829 | /* Never glue messages from different writers */ | 1834 | /* Never glue messages from different writers */ |
1830 | if (memcmp(UNIXCREDS(skb), &siocb->scm->creds, sizeof(siocb->scm->creds)) != 0) { | 1835 | if (memcmp(UNIXCREDS(skb), &siocb->scm->creds, |
1836 | sizeof(siocb->scm->creds)) != 0) { | ||
1831 | skb_queue_head(&sk->sk_receive_queue, skb); | 1837 | skb_queue_head(&sk->sk_receive_queue, skb); |
1832 | break; | 1838 | break; |
1833 | } | 1839 | } |
@@ -1838,8 +1844,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1838 | } | 1844 | } |
1839 | 1845 | ||
1840 | /* Copy address just once */ | 1846 | /* Copy address just once */ |
1841 | if (sunaddr) | 1847 | if (sunaddr) { |
1842 | { | ||
1843 | unix_copy_addr(msg, skb->sk); | 1848 | unix_copy_addr(msg, skb->sk); |
1844 | sunaddr = NULL; | 1849 | sunaddr = NULL; |
1845 | } | 1850 | } |
@@ -1855,16 +1860,14 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1855 | size -= chunk; | 1860 | size -= chunk; |
1856 | 1861 | ||
1857 | /* Mark read part of skb as used */ | 1862 | /* Mark read part of skb as used */ |
1858 | if (!(flags & MSG_PEEK)) | 1863 | if (!(flags & MSG_PEEK)) { |
1859 | { | ||
1860 | skb_pull(skb, chunk); | 1864 | skb_pull(skb, chunk); |
1861 | 1865 | ||
1862 | if (UNIXCB(skb).fp) | 1866 | if (UNIXCB(skb).fp) |
1863 | unix_detach_fds(siocb->scm, skb); | 1867 | unix_detach_fds(siocb->scm, skb); |
1864 | 1868 | ||
1865 | /* put the skb back if we didn't use it up.. */ | 1869 | /* put the skb back if we didn't use it up.. */ |
1866 | if (skb->len) | 1870 | if (skb->len) { |
1867 | { | ||
1868 | skb_queue_head(&sk->sk_receive_queue, skb); | 1871 | skb_queue_head(&sk->sk_receive_queue, skb); |
1869 | break; | 1872 | break; |
1870 | } | 1873 | } |
@@ -1873,9 +1876,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1873 | 1876 | ||
1874 | if (siocb->scm->fp) | 1877 | if (siocb->scm->fp) |
1875 | break; | 1878 | break; |
1876 | } | 1879 | } else { |
1877 | else | ||
1878 | { | ||
1879 | /* It is questionable, see note in unix_dgram_recvmsg. | 1880 | /* It is questionable, see note in unix_dgram_recvmsg. |
1880 | */ | 1881 | */ |
1881 | if (UNIXCB(skb).fp) | 1882 | if (UNIXCB(skb).fp) |
@@ -1903,7 +1904,7 @@ static int unix_shutdown(struct socket *sock, int mode) | |||
1903 | if (mode) { | 1904 | if (mode) { |
1904 | unix_state_lock(sk); | 1905 | unix_state_lock(sk); |
1905 | sk->sk_shutdown |= mode; | 1906 | sk->sk_shutdown |= mode; |
1906 | other=unix_peer(sk); | 1907 | other = unix_peer(sk); |
1907 | if (other) | 1908 | if (other) |
1908 | sock_hold(other); | 1909 | sock_hold(other); |
1909 | unix_state_unlock(sk); | 1910 | unix_state_unlock(sk); |
@@ -1938,16 +1939,15 @@ static int unix_shutdown(struct socket *sock, int mode) | |||
1938 | static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 1939 | static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
1939 | { | 1940 | { |
1940 | struct sock *sk = sock->sk; | 1941 | struct sock *sk = sock->sk; |
1941 | long amount=0; | 1942 | long amount = 0; |
1942 | int err; | 1943 | int err; |
1943 | 1944 | ||
1944 | switch(cmd) | 1945 | switch (cmd) { |
1945 | { | 1946 | case SIOCOUTQ: |
1946 | case SIOCOUTQ: | 1947 | amount = atomic_read(&sk->sk_wmem_alloc); |
1947 | amount = atomic_read(&sk->sk_wmem_alloc); | 1948 | err = put_user(amount, (int __user *)arg); |
1948 | err = put_user(amount, (int __user *)arg); | 1949 | break; |
1949 | break; | 1950 | case SIOCINQ: |
1950 | case SIOCINQ: | ||
1951 | { | 1951 | { |
1952 | struct sk_buff *skb; | 1952 | struct sk_buff *skb; |
1953 | 1953 | ||
@@ -1964,21 +1964,21 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1964 | } else { | 1964 | } else { |
1965 | skb = skb_peek(&sk->sk_receive_queue); | 1965 | skb = skb_peek(&sk->sk_receive_queue); |
1966 | if (skb) | 1966 | if (skb) |
1967 | amount=skb->len; | 1967 | amount = skb->len; |
1968 | } | 1968 | } |
1969 | spin_unlock(&sk->sk_receive_queue.lock); | 1969 | spin_unlock(&sk->sk_receive_queue.lock); |
1970 | err = put_user(amount, (int __user *)arg); | 1970 | err = put_user(amount, (int __user *)arg); |
1971 | break; | 1971 | break; |
1972 | } | 1972 | } |
1973 | 1973 | ||
1974 | default: | 1974 | default: |
1975 | err = -ENOIOCTLCMD; | 1975 | err = -ENOIOCTLCMD; |
1976 | break; | 1976 | break; |
1977 | } | 1977 | } |
1978 | return err; | 1978 | return err; |
1979 | } | 1979 | } |
1980 | 1980 | ||
1981 | static unsigned int unix_poll(struct file * file, struct socket *sock, poll_table *wait) | 1981 | static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait) |
1982 | { | 1982 | { |
1983 | struct sock *sk = sock->sk; | 1983 | struct sock *sk = sock->sk; |
1984 | unsigned int mask; | 1984 | unsigned int mask; |
@@ -2000,7 +2000,8 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
2000 | mask |= POLLIN | POLLRDNORM; | 2000 | mask |= POLLIN | POLLRDNORM; |
2001 | 2001 | ||
2002 | /* Connection-based need to check for termination and startup */ | 2002 | /* Connection-based need to check for termination and startup */ |
2003 | if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && sk->sk_state == TCP_CLOSE) | 2003 | if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && |
2004 | sk->sk_state == TCP_CLOSE) | ||
2004 | mask |= POLLHUP; | 2005 | mask |= POLLHUP; |
2005 | 2006 | ||
2006 | /* | 2007 | /* |
@@ -2096,6 +2097,7 @@ struct unix_iter_state { | |||
2096 | struct seq_net_private p; | 2097 | struct seq_net_private p; |
2097 | int i; | 2098 | int i; |
2098 | }; | 2099 | }; |
2100 | |||
2099 | static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos) | 2101 | static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos) |
2100 | { | 2102 | { |
2101 | struct unix_iter_state *iter = seq->private; | 2103 | struct unix_iter_state *iter = seq->private; |
@@ -2112,7 +2114,6 @@ static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos) | |||
2112 | return NULL; | 2114 | return NULL; |
2113 | } | 2115 | } |
2114 | 2116 | ||
2115 | |||
2116 | static void *unix_seq_start(struct seq_file *seq, loff_t *pos) | 2117 | static void *unix_seq_start(struct seq_file *seq, loff_t *pos) |
2117 | __acquires(unix_table_lock) | 2118 | __acquires(unix_table_lock) |
2118 | { | 2119 | { |
@@ -2192,7 +2193,6 @@ static const struct seq_operations unix_seq_ops = { | |||
2192 | .show = unix_seq_show, | 2193 | .show = unix_seq_show, |
2193 | }; | 2194 | }; |
2194 | 2195 | ||
2195 | |||
2196 | static int unix_seq_open(struct inode *inode, struct file *file) | 2196 | static int unix_seq_open(struct inode *inode, struct file *file) |
2197 | { | 2197 | { |
2198 | return seq_open_net(inode, file, &unix_seq_ops, | 2198 | return seq_open_net(inode, file, &unix_seq_ops, |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index abb3ab34cb1e..19c17e4a0c8b 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -106,8 +106,8 @@ static struct sock *unix_get_socket(struct file *filp) | |||
106 | * Socket ? | 106 | * Socket ? |
107 | */ | 107 | */ |
108 | if (S_ISSOCK(inode->i_mode)) { | 108 | if (S_ISSOCK(inode->i_mode)) { |
109 | struct socket * sock = SOCKET_I(inode); | 109 | struct socket *sock = SOCKET_I(inode); |
110 | struct sock * s = sock->sk; | 110 | struct sock *s = sock->sk; |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * PF_UNIX ? | 113 | * PF_UNIX ? |
@@ -126,7 +126,7 @@ static struct sock *unix_get_socket(struct file *filp) | |||
126 | void unix_inflight(struct file *fp) | 126 | void unix_inflight(struct file *fp) |
127 | { | 127 | { |
128 | struct sock *s = unix_get_socket(fp); | 128 | struct sock *s = unix_get_socket(fp); |
129 | if(s) { | 129 | if (s) { |
130 | struct unix_sock *u = unix_sk(s); | 130 | struct unix_sock *u = unix_sk(s); |
131 | spin_lock(&unix_gc_lock); | 131 | spin_lock(&unix_gc_lock); |
132 | if (atomic_long_inc_return(&u->inflight) == 1) { | 132 | if (atomic_long_inc_return(&u->inflight) == 1) { |
@@ -143,7 +143,7 @@ void unix_inflight(struct file *fp) | |||
143 | void unix_notinflight(struct file *fp) | 143 | void unix_notinflight(struct file *fp) |
144 | { | 144 | { |
145 | struct sock *s = unix_get_socket(fp); | 145 | struct sock *s = unix_get_socket(fp); |
146 | if(s) { | 146 | if (s) { |
147 | struct unix_sock *u = unix_sk(s); | 147 | struct unix_sock *u = unix_sk(s); |
148 | spin_lock(&unix_gc_lock); | 148 | spin_lock(&unix_gc_lock); |
149 | BUG_ON(list_empty(&u->link)); | 149 | BUG_ON(list_empty(&u->link)); |
@@ -156,7 +156,7 @@ void unix_notinflight(struct file *fp) | |||
156 | 156 | ||
157 | static inline struct sk_buff *sock_queue_head(struct sock *sk) | 157 | static inline struct sk_buff *sock_queue_head(struct sock *sk) |
158 | { | 158 | { |
159 | return (struct sk_buff *) &sk->sk_receive_queue; | 159 | return (struct sk_buff *)&sk->sk_receive_queue; |
160 | } | 160 | } |
161 | 161 | ||
162 | #define receive_queue_for_each_skb(sk, next, skb) \ | 162 | #define receive_queue_for_each_skb(sk, next, skb) \ |
@@ -370,7 +370,7 @@ void unix_gc(void) | |||
370 | */ | 370 | */ |
371 | skb_queue_head_init(&hitlist); | 371 | skb_queue_head_init(&hitlist); |
372 | list_for_each_entry(u, &gc_candidates, link) | 372 | list_for_each_entry(u, &gc_candidates, link) |
373 | scan_children(&u->sk, inc_inflight, &hitlist); | 373 | scan_children(&u->sk, inc_inflight, &hitlist); |
374 | 374 | ||
375 | spin_unlock(&unix_gc_lock); | 375 | spin_unlock(&unix_gc_lock); |
376 | 376 | ||
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index 77513d7e35f2..83c093077ebc 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c | |||
@@ -21,7 +21,7 @@ static ctl_table unix_table[] = { | |||
21 | .data = &init_net.unx.sysctl_max_dgram_qlen, | 21 | .data = &init_net.unx.sysctl_max_dgram_qlen, |
22 | .maxlen = sizeof(int), | 22 | .maxlen = sizeof(int), |
23 | .mode = 0644, | 23 | .mode = 0644, |
24 | .proc_handler = &proc_dointvec | 24 | .proc_handler = proc_dointvec |
25 | }, | 25 | }, |
26 | { .ctl_name = 0 } | 26 | { .ctl_name = 0 } |
27 | }; | 27 | }; |
@@ -61,4 +61,3 @@ void unix_sysctl_unregister(struct net *net) | |||
61 | unregister_sysctl_table(net->unx.ctl); | 61 | unregister_sysctl_table(net->unx.ctl); |
62 | kfree(table); | 62 | kfree(table); |
63 | } | 63 | } |
64 | |||