Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[TCP]: DSACK signals data receival, be conservative
[TCP]: Also handle snd_una changes in tcp_cwnd_down
[TIPC]: Fix two minor sparse warnings.
[TIPC]: Make function tipc_nameseq_subscribe static.
[PF_KEY]: Fix ipsec not working in 2.6.23-rc1-git10
[TCP]: Invoke tcp_sendmsg() directly, do not use inet_sendmsg().
[IPV4] route.c: mostly kmalloc + memset conversion to k[cz]alloc
[IPV4] raw.c: kmalloc + memset conversion to kzalloc
[NETFILTER] nf_conntrack_l3proto_ipv4_compat.c: kmalloc + memset conversion to kzalloc
[NETFILTER] nf_conntrack_expect.c: kmalloc + memset conversion to kzalloc
[NET]: Removal of duplicated include net/wanrouter/wanmain.c
SCTP: remove useless code in function sctp_init_cause
SCTP: drop SACK if ctsn is not less than the next tsn of assoc
SCTP: IPv4 mapped addr not returned in SCTPv6 accept()
SCTP: IPv4 mapped addr not returned in SCTPv6 accept()
sctp: fix shadow symbol in net/sctp/tsnmap.c
sctp: try to fix readlock
sctp: remove shadowed symbols
sctp: move global declaration to header file.
sctp: make locally used function static

+162 -96
+10
include/net/sctp/sctp.h
··· 190 190 191 191 192 192 /* 193 + * Module global variables 194 + */ 195 + 196 + /* 197 + * sctp/protocol.c 198 + */ 199 + extern struct kmem_cache *sctp_chunk_cachep __read_mostly; 200 + extern struct kmem_cache *sctp_bucket_cachep __read_mostly; 201 + 202 + /* 193 203 * Section: Macros, externs, and inlines 194 204 */ 195 205
+1 -1
include/net/tcp.h
··· 281 281 282 282 extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 283 283 284 - extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, 284 + extern int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, 285 285 struct msghdr *msg, size_t size); 286 286 extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); 287 287
+1 -1
net/ipv4/af_inet.c
··· 831 831 .shutdown = inet_shutdown, 832 832 .setsockopt = sock_common_setsockopt, 833 833 .getsockopt = sock_common_getsockopt, 834 - .sendmsg = inet_sendmsg, 834 + .sendmsg = tcp_sendmsg, 835 835 .recvmsg = sock_common_recvmsg, 836 836 .mmap = sock_no_mmap, 837 837 .sendpage = tcp_sendpage,
+2 -3
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
··· 294 294 struct ct_expect_iter_state *st; 295 295 int ret; 296 296 297 - st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 298 - if (st == NULL) 297 + st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 298 + if (!st) 299 299 return -ENOMEM; 300 300 ret = seq_open(file, &exp_seq_ops); 301 301 if (ret) 302 302 goto out_free; 303 303 seq = file->private_data; 304 304 seq->private = st; 305 - memset(st, 0, sizeof(struct ct_expect_iter_state)); 306 305 return ret; 307 306 out_free: 308 307 kfree(st);
+2 -2
net/ipv4/raw.c
··· 900 900 { 901 901 struct seq_file *seq; 902 902 int rc = -ENOMEM; 903 - struct raw_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); 903 + struct raw_iter_state *s; 904 904 905 + s = kzalloc(sizeof(*s), GFP_KERNEL); 905 906 if (!s) 906 907 goto out; 907 908 rc = seq_open(file, &raw_seq_ops); ··· 911 910 912 911 seq = file->private_data; 913 912 seq->private = s; 914 - memset(s, 0, sizeof(*s)); 915 913 out: 916 914 return rc; 917 915 out_kfree:
+2 -2
net/ipv4/route.c
··· 374 374 { 375 375 struct seq_file *seq; 376 376 int rc = -ENOMEM; 377 - struct rt_cache_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); 377 + struct rt_cache_iter_state *s; 378 378 379 + s = kzalloc(sizeof(*s), GFP_KERNEL); 379 380 if (!s) 380 381 goto out; 381 382 rc = seq_open(file, &rt_cache_seq_ops); ··· 384 383 goto out_kfree; 385 384 seq = file->private_data; 386 385 seq->private = s; 387 - memset(s, 0, sizeof(*s)); 388 386 out: 389 387 return rc; 390 388 out_kfree:
+2 -1
net/ipv4/tcp.c
··· 658 658 return tmp; 659 659 } 660 660 661 - int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 661 + int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, 662 662 size_t size) 663 663 { 664 + struct sock *sk = sock->sk; 664 665 struct iovec *iov; 665 666 struct tcp_sock *tp = tcp_sk(sk); 666 667 struct sk_buff *skb;
+21 -16
net/ipv4/tcp_input.c
··· 102 102 #define FLAG_DATA_LOST 0x80 /* SACK detected data lossage. */ 103 103 #define FLAG_SLOWPATH 0x100 /* Do not skip RFC checks for window update.*/ 104 104 #define FLAG_ONLY_ORIG_SACKED 0x200 /* SACKs only non-rexmit sent before RTO */ 105 + #define FLAG_SND_UNA_ADVANCED 0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */ 106 + #define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained DSACK info */ 105 107 106 108 #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) 107 109 #define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) 108 110 #define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE) 109 111 #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) 112 + #define FLAG_ANY_PROGRESS (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED) 110 113 111 114 #define IsReno(tp) ((tp)->rx_opt.sack_ok == 0) 112 115 #define IsFack(tp) ((tp)->rx_opt.sack_ok & 2) ··· 967 964 968 965 /* Check for D-SACK. */ 969 966 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) { 967 + flag |= FLAG_DSACKING_ACK; 970 968 found_dup_sack = 1; 971 969 tp->rx_opt.sack_ok |= 4; 972 970 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); 973 971 } else if (num_sacks > 1 && 974 972 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) && 975 973 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) { 974 + flag |= FLAG_DSACKING_ACK; 976 975 found_dup_sack = 1; 977 976 tp->rx_opt.sack_ok |= 4; 978 977 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV); ··· 1861 1856 struct tcp_sock *tp = tcp_sk(sk); 1862 1857 int decr = tp->snd_cwnd_cnt + 1; 1863 1858 1864 - if ((flag&FLAG_FORWARD_PROGRESS) || 1859 + if ((flag&(FLAG_ANY_PROGRESS|FLAG_DSACKING_ACK)) || 1865 1860 (IsReno(tp) && !(flag&FLAG_NOT_DUP))) { 1866 1861 tp->snd_cwnd_cnt = decr&1; 1867 1862 decr >>= 1; ··· 2112 2107 * tcp_xmit_retransmit_queue(). 2113 2108 */ 2114 2109 static void 2115 - tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, 2116 - int prior_packets, int flag) 2110 + tcp_fastretrans_alert(struct sock *sk, int prior_packets, int flag) 2117 2111 { 2118 2112 struct inet_connection_sock *icsk = inet_csk(sk); 2119 2113 struct tcp_sock *tp = tcp_sk(sk); 2120 - int is_dupack = (tp->snd_una == prior_snd_una && 2121 - (!(flag&FLAG_NOT_DUP) || 2122 - ((flag&FLAG_DATA_SACKED) && 2123 - (tp->fackets_out > tp->reordering)))); 2114 + int is_dupack = !(flag&(FLAG_SND_UNA_ADVANCED|FLAG_NOT_DUP)); 2115 + int do_lost = is_dupack || ((flag&FLAG_DATA_SACKED) && 2116 + (tp->fackets_out > tp->reordering)); 2124 2117 2125 2118 /* Some technical things: 2126 2119 * 1. Reno does not count dupacks (sacked_out) automatically. */ ··· 2195 2192 /* F. Process state. */ 2196 2193 switch (icsk->icsk_ca_state) { 2197 2194 case TCP_CA_Recovery: 2198 - if (prior_snd_una == tp->snd_una) { 2195 + if (!(flag & FLAG_SND_UNA_ADVANCED)) { 2199 2196 if (IsReno(tp) && is_dupack) 2200 2197 tcp_add_reno_sack(sk); 2201 2198 } else { 2202 2199 int acked = prior_packets - tp->packets_out; 2203 2200 if (IsReno(tp)) 2204 2201 tcp_remove_reno_sacks(sk, acked); 2205 - is_dupack = tcp_try_undo_partial(sk, acked); 2202 + do_lost = tcp_try_undo_partial(sk, acked); 2206 2203 } 2207 2204 break; 2208 2205 case TCP_CA_Loss: ··· 2218 2215 /* Loss is undone; fall through to processing in Open state. */ 2219 2216 default: 2220 2217 if (IsReno(tp)) { 2221 - if (tp->snd_una != prior_snd_una) 2218 + if (flag & FLAG_SND_UNA_ADVANCED) 2222 2219 tcp_reset_reno_sack(tp); 2223 2220 if (is_dupack) 2224 2221 tcp_add_reno_sack(sk); ··· 2267 2264 tcp_set_ca_state(sk, TCP_CA_Recovery); 2268 2265 } 2269 2266 2270 - if (is_dupack || tcp_head_timedout(sk)) 2267 + if (do_lost || tcp_head_timedout(sk)) 2271 2268 tcp_update_scoreboard(sk); 2272 2269 tcp_cwnd_down(sk, flag); 2273 2270 tcp_xmit_retransmit_queue(sk); ··· 2687 2684 * to prove that the RTO is indeed spurious. It transfers the control 2688 2685 * from F-RTO to the conventional RTO recovery 2689 2686 */ 2690 - static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag) 2687 + static int tcp_process_frto(struct sock *sk, int flag) 2691 2688 { 2692 2689 struct tcp_sock *tp = tcp_sk(sk); 2693 2690 ··· 2707 2704 * ACK isn't duplicate nor advances window, e.g., opposite dir 2708 2705 * data, winupdate 2709 2706 */ 2710 - if ((tp->snd_una == prior_snd_una) && (flag&FLAG_NOT_DUP) && 2711 - !(flag&FLAG_FORWARD_PROGRESS)) 2707 + if (!(flag&FLAG_ANY_PROGRESS) && (flag&FLAG_NOT_DUP)) 2712 2708 return 1; 2713 2709 2714 2710 if (!(flag&FLAG_DATA_ACKED)) { ··· 2787 2785 if (before(ack, prior_snd_una)) 2788 2786 goto old_ack; 2789 2787 2788 + if (after(ack, prior_snd_una)) 2789 + flag |= FLAG_SND_UNA_ADVANCED; 2790 + 2790 2791 if (sysctl_tcp_abc) { 2791 2792 if (icsk->icsk_ca_state < TCP_CA_CWR) 2792 2793 tp->bytes_acked += ack - prior_snd_una; ··· 2842 2837 flag |= tcp_clean_rtx_queue(sk, &seq_rtt); 2843 2838 2844 2839 if (tp->frto_counter) 2845 - frto_cwnd = tcp_process_frto(sk, prior_snd_una, flag); 2840 + frto_cwnd = tcp_process_frto(sk, flag); 2846 2841 2847 2842 if (tcp_ack_is_dubious(sk, flag)) { 2848 2843 /* Advance CWND, if state allows this. */ 2849 2844 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd && 2850 2845 tcp_may_raise_cwnd(sk, flag)) 2851 2846 tcp_cong_avoid(sk, ack, prior_in_flight, 0); 2852 - tcp_fastretrans_alert(sk, prior_snd_una, prior_packets, flag); 2847 + tcp_fastretrans_alert(sk, prior_packets, flag); 2853 2848 } else { 2854 2849 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd) 2855 2850 tcp_cong_avoid(sk, ack, prior_in_flight, 1);
-1
net/ipv4/tcp_ipv4.c
··· 2425 2425 .shutdown = tcp_shutdown, 2426 2426 .setsockopt = tcp_setsockopt, 2427 2427 .getsockopt = tcp_getsockopt, 2428 - .sendmsg = tcp_sendmsg, 2429 2428 .recvmsg = tcp_recvmsg, 2430 2429 .backlog_rcv = tcp_v4_do_rcv, 2431 2430 .hash = tcp_v4_hash,
+1 -1
net/ipv6/af_inet6.c
··· 484 484 .shutdown = inet_shutdown, /* ok */ 485 485 .setsockopt = sock_common_setsockopt, /* ok */ 486 486 .getsockopt = sock_common_getsockopt, /* ok */ 487 - .sendmsg = inet_sendmsg, /* ok */ 487 + .sendmsg = tcp_sendmsg, /* ok */ 488 488 .recvmsg = sock_common_recvmsg, /* ok */ 489 489 .mmap = sock_no_mmap, 490 490 .sendpage = tcp_sendpage,
-1
net/ipv6/tcp_ipv6.c
··· 2115 2115 .shutdown = tcp_shutdown, 2116 2116 .setsockopt = tcp_setsockopt, 2117 2117 .getsockopt = tcp_getsockopt, 2118 - .sendmsg = tcp_sendmsg, 2119 2118 .recvmsg = tcp_recvmsg, 2120 2119 .backlog_rcv = tcp_v6_do_rcv, 2121 2120 .hash = tcp_v6_hash,
+3
net/key/af_key.c
··· 1206 1206 x->sel.prefixlen_s = addr->sadb_address_prefixlen; 1207 1207 } 1208 1208 1209 + if (!x->sel.family) 1210 + x->sel.family = x->props.family; 1211 + 1209 1212 if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) { 1210 1213 struct sadb_x_nat_t_type* n_type; 1211 1214 struct xfrm_encap_tmpl *natt;
+2 -3
net/netfilter/nf_conntrack_expect.c
··· 477 477 struct ct_expect_iter_state *st; 478 478 int ret; 479 479 480 - st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 481 - if (st == NULL) 480 + st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 481 + if (!st) 482 482 return -ENOMEM; 483 483 ret = seq_open(file, &exp_seq_ops); 484 484 if (ret) 485 485 goto out_free; 486 486 seq = file->private_data; 487 487 seq->private = st; 488 - memset(st, 0, sizeof(struct ct_expect_iter_state)); 489 488 return ret; 490 489 out_free: 491 490 kfree(st);
+1 -1
net/sctp/input.c
··· 590 590 * Return 0 - If further processing is needed. 591 591 * Return 1 - If the packet can be discarded right away. 592 592 */ 593 - int sctp_rcv_ootb(struct sk_buff *skb) 593 + static int sctp_rcv_ootb(struct sk_buff *skb) 594 594 { 595 595 sctp_chunkhdr_t *ch; 596 596 __u8 *ch_end;
+2
net/sctp/ipv6.c
··· 641 641 newsctp6sk = (struct sctp6_sock *)newsk; 642 642 inet_sk(newsk)->pinet6 = &newsctp6sk->inet6; 643 643 644 + sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped; 645 + 644 646 newinet = inet_sk(newsk); 645 647 newnp = inet6_sk(newsk); 646 648
-6
net/sctp/sm_make_chunk.c
··· 65 65 #include <net/sctp/sctp.h> 66 66 #include <net/sctp/sm.h> 67 67 68 - extern struct kmem_cache *sctp_chunk_cachep; 69 - 70 68 SCTP_STATIC 71 69 struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc, 72 70 __u8 type, __u8 flags, int paylen); ··· 113 115 const void *payload, size_t paylen) 114 116 { 115 117 sctp_errhdr_t err; 116 - int padlen; 117 118 __u16 len; 118 119 119 120 /* Cause code constants are now defined in network order. */ 120 121 err.cause = cause_code; 121 122 len = sizeof(sctp_errhdr_t) + paylen; 122 - padlen = len % 4; 123 123 err.length = htons(len); 124 - len += padlen; 125 124 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); 126 125 sctp_addto_chunk(chunk, paylen, payload); 127 126 } ··· 1449 1454 do_gettimeofday(&tv); 1450 1455 1451 1456 if (!asoc && tv_lt(bear_cookie->expiration, tv)) { 1452 - __u16 len; 1453 1457 /* 1454 1458 * Section 3.3.10.3 Stale Cookie Error (3) 1455 1459 *
+78 -25
net/sctp/sm_statefuns.c
··· 97 97 const struct sctp_association *asoc, 98 98 struct sctp_transport *transport); 99 99 100 + static sctp_disposition_t sctp_sf_abort_violation( 101 + const struct sctp_association *asoc, 102 + void *arg, 103 + sctp_cmd_seq_t *commands, 104 + const __u8 *payload, 105 + const size_t paylen); 106 + 100 107 static sctp_disposition_t sctp_sf_violation_chunklen( 108 + const struct sctp_endpoint *ep, 109 + const struct sctp_association *asoc, 110 + const sctp_subtype_t type, 111 + void *arg, 112 + sctp_cmd_seq_t *commands); 113 + 114 + static sctp_disposition_t sctp_sf_violation_ctsn( 101 115 const struct sctp_endpoint *ep, 102 116 const struct sctp_association *asoc, 103 117 const sctp_subtype_t type, ··· 2894 2880 return SCTP_DISPOSITION_DISCARD; 2895 2881 } 2896 2882 2883 + /* If Cumulative TSN Ack beyond the max tsn currently 2884 + * send, terminating the association and respond to the 2885 + * sender with an ABORT. 2886 + */ 2887 + if (!TSN_lt(ctsn, asoc->next_tsn)) 2888 + return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands); 2889 + 2897 2890 /* Return this SACK for further processing. */ 2898 2891 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh)); 2899 2892 ··· 3712 3691 return SCTP_DISPOSITION_VIOLATION; 3713 3692 } 3714 3693 3715 - 3716 3694 /* 3717 - * Handle a protocol violation when the chunk length is invalid. 3718 - * "Invalid" length is identified as smaller then the minimal length a 3719 - * given chunk can be. For example, a SACK chunk has invalid length 3720 - * if it's length is set to be smaller then the size of sctp_sack_chunk_t. 3721 - * 3722 - * We inform the other end by sending an ABORT with a Protocol Violation 3723 - * error code. 3724 - * 3725 - * Section: Not specified 3726 - * Verification Tag: Nothing to do 3727 - * Inputs 3728 - * (endpoint, asoc, chunk) 3729 - * 3730 - * Outputs 3731 - * (reply_msg, msg_up, counters) 3732 - * 3733 - * Generate an ABORT chunk and terminate the association. 3695 + * Common function to handle a protocol violation. 3734 3696 */ 3735 - static sctp_disposition_t sctp_sf_violation_chunklen( 3736 - const struct sctp_endpoint *ep, 3697 + static sctp_disposition_t sctp_sf_abort_violation( 3737 3698 const struct sctp_association *asoc, 3738 - const sctp_subtype_t type, 3739 3699 void *arg, 3740 - sctp_cmd_seq_t *commands) 3700 + sctp_cmd_seq_t *commands, 3701 + const __u8 *payload, 3702 + const size_t paylen) 3741 3703 { 3742 3704 struct sctp_chunk *chunk = arg; 3743 3705 struct sctp_chunk *abort = NULL; 3744 - char err_str[]="The following chunk had invalid length:"; 3745 3706 3746 3707 /* Make the abort chunk. */ 3747 - abort = sctp_make_abort_violation(asoc, chunk, err_str, 3748 - sizeof(err_str)); 3708 + abort = sctp_make_abort_violation(asoc, chunk, payload, paylen); 3749 3709 if (!abort) 3750 3710 goto nomem; 3751 3711 ··· 3756 3754 3757 3755 nomem: 3758 3756 return SCTP_DISPOSITION_NOMEM; 3757 + } 3758 + 3759 + /* 3760 + * Handle a protocol violation when the chunk length is invalid. 3761 + * "Invalid" length is identified as smaller then the minimal length a 3762 + * given chunk can be. For example, a SACK chunk has invalid length 3763 + * if it's length is set to be smaller then the size of sctp_sack_chunk_t. 3764 + * 3765 + * We inform the other end by sending an ABORT with a Protocol Violation 3766 + * error code. 3767 + * 3768 + * Section: Not specified 3769 + * Verification Tag: Nothing to do 3770 + * Inputs 3771 + * (endpoint, asoc, chunk) 3772 + * 3773 + * Outputs 3774 + * (reply_msg, msg_up, counters) 3775 + * 3776 + * Generate an ABORT chunk and terminate the association. 3777 + */ 3778 + static sctp_disposition_t sctp_sf_violation_chunklen( 3779 + const struct sctp_endpoint *ep, 3780 + const struct sctp_association *asoc, 3781 + const sctp_subtype_t type, 3782 + void *arg, 3783 + sctp_cmd_seq_t *commands) 3784 + { 3785 + char err_str[]="The following chunk had invalid length:"; 3786 + 3787 + return sctp_sf_abort_violation(asoc, arg, commands, err_str, 3788 + sizeof(err_str)); 3789 + } 3790 + 3791 + /* Handle a protocol violation when the peer trying to advance the 3792 + * cumulative tsn ack to a point beyond the max tsn currently sent. 3793 + * 3794 + * We inform the other end by sending an ABORT with a Protocol Violation 3795 + * error code. 3796 + */ 3797 + static sctp_disposition_t sctp_sf_violation_ctsn( 3798 + const struct sctp_endpoint *ep, 3799 + const struct sctp_association *asoc, 3800 + const sctp_subtype_t type, 3801 + void *arg, 3802 + sctp_cmd_seq_t *commands) 3803 + { 3804 + char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:"; 3805 + 3806 + return sctp_sf_abort_violation(asoc, arg, commands, err_str, 3807 + sizeof(err_str)); 3759 3808 } 3760 3809 3761 3810 /***************************************************************************
+25 -20
net/sctp/socket.c
··· 107 107 struct sctp_association *, sctp_socket_type_t); 108 108 static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG; 109 109 110 - extern struct kmem_cache *sctp_bucket_cachep; 111 - 112 110 /* Get the sndbuf space available at the time on the association. */ 113 111 static inline int sctp_wspace(struct sctp_association *asoc) 114 112 { ··· 431 433 * 432 434 * Only sctp_setsockopt_bindx() is supposed to call this function. 433 435 */ 434 - int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) 436 + static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) 435 437 { 436 438 int cnt; 437 439 int retval = 0; ··· 600 602 * 601 603 * Only sctp_setsockopt_bindx() is supposed to call this function. 602 604 */ 603 - int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) 605 + static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) 604 606 { 605 607 struct sctp_sock *sp = sctp_sk(sk); 606 608 struct sctp_endpoint *ep = sp->ep; ··· 975 977 int err = 0; 976 978 int addrcnt = 0; 977 979 int walk_size = 0; 978 - union sctp_addr *sa_addr; 980 + union sctp_addr *sa_addr = NULL; 979 981 void *addr_buf; 980 982 unsigned short port; 981 983 unsigned int f_flags = 0; ··· 1009 1011 goto out_free; 1010 1012 } 1011 1013 1012 - err = sctp_verify_addr(sk, sa_addr, af->sockaddr_len); 1014 + /* Save current address so we can work with it */ 1015 + memcpy(&to, sa_addr, af->sockaddr_len); 1016 + 1017 + err = sctp_verify_addr(sk, &to, af->sockaddr_len); 1013 1018 if (err) 1014 1019 goto out_free; 1015 1020 ··· 1022 1021 if (asoc && asoc->peer.port && asoc->peer.port != port) 1023 1022 goto out_free; 1024 1023 1025 - memcpy(&to, sa_addr, af->sockaddr_len); 1026 1024 1027 1025 /* Check if there already is a matching association on the 1028 1026 * endpoint (other than the one created here). 1029 1027 */ 1030 - asoc2 = sctp_endpoint_lookup_assoc(ep, sa_addr, &transport); 1028 + asoc2 = sctp_endpoint_lookup_assoc(ep, &to, &transport); 1031 1029 if (asoc2 && asoc2 != asoc) { 1032 1030 if (asoc2->state >= SCTP_STATE_ESTABLISHED) 1033 1031 err = -EISCONN; ··· 1039 1039 * make sure that there is no peeled-off association matching 1040 1040 * the peer address even on another socket. 1041 1041 */ 1042 - if (sctp_endpoint_is_peeled_off(ep, sa_addr)) { 1042 + if (sctp_endpoint_is_peeled_off(ep, &to)) { 1043 1043 err = -EADDRNOTAVAIL; 1044 1044 goto out_free; 1045 1045 } ··· 1070 1070 } 1071 1071 } 1072 1072 1073 - scope = sctp_scope(sa_addr); 1073 + scope = sctp_scope(&to); 1074 1074 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); 1075 1075 if (!asoc) { 1076 1076 err = -ENOMEM; ··· 1079 1079 } 1080 1080 1081 1081 /* Prime the peer's transport structures. */ 1082 - transport = sctp_assoc_add_peer(asoc, sa_addr, GFP_KERNEL, 1082 + transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL, 1083 1083 SCTP_UNKNOWN); 1084 1084 if (!transport) { 1085 1085 err = -ENOMEM; ··· 1103 1103 1104 1104 /* Initialize sk's dport and daddr for getpeername() */ 1105 1105 inet_sk(sk)->dport = htons(asoc->peer.port); 1106 - af = sctp_get_af_specific(to.sa.sa_family); 1107 - af->to_sk_daddr(&to, sk); 1106 + af = sctp_get_af_specific(sa_addr->sa.sa_family); 1107 + af->to_sk_daddr(sa_addr, sk); 1108 1108 sk->sk_err = 0; 1109 1109 1110 1110 /* in-kernel sockets don't generally have a file allocated to them ··· 1531 1531 goto out_unlock; 1532 1532 } 1533 1533 if (sinfo_flags & SCTP_ABORT) { 1534 - struct sctp_chunk *chunk; 1535 1534 1536 1535 chunk = sctp_make_abort_user(asoc, msg, msg_len); 1537 1536 if (!chunk) { ··· 4352 4353 space_left, &bytes_copied); 4353 4354 if (cnt < 0) { 4354 4355 err = cnt; 4355 - goto error; 4356 + goto error_lock; 4356 4357 } 4357 4358 goto copy_getaddrs; 4358 4359 } ··· 4366 4367 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 4367 4368 if (space_left < addrlen) { 4368 4369 err = -ENOMEM; /*fixme: right error?*/ 4369 - goto error; 4370 + goto error_lock; 4370 4371 } 4371 4372 memcpy(buf, &temp, addrlen); 4372 4373 buf += addrlen; ··· 4380 4381 4381 4382 if (copy_to_user(to, addrs, bytes_copied)) { 4382 4383 err = -EFAULT; 4383 - goto error; 4384 + goto out; 4384 4385 } 4385 4386 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) { 4386 4387 err = -EFAULT; 4387 - goto error; 4388 + goto out; 4388 4389 } 4389 4390 if (put_user(bytes_copied, optlen)) 4390 4391 err = -EFAULT; 4391 - error: 4392 + 4393 + goto out; 4394 + 4395 + error_lock: 4396 + sctp_read_unlock(addr_lock); 4397 + 4398 + out: 4392 4399 kfree(addrs); 4393 4400 return err; 4394 4401 } ··· 5969 5964 return err; 5970 5965 } 5971 5966 5972 - void sctp_wait_for_close(struct sock *sk, long timeout) 5967 + static void sctp_wait_for_close(struct sock *sk, long timeout) 5973 5968 { 5974 5969 DEFINE_WAIT(wait); 5975 5970
+7 -7
net/sctp/tsnmap.c
··· 161 161 __u16 *start, __u16 *end) 162 162 { 163 163 int started, ended; 164 - __u16 _start, _end, offset; 164 + __u16 start_, end_, offset; 165 165 166 166 /* We haven't found a gap yet. */ 167 167 started = ended = 0; ··· 175 175 176 176 offset = iter->start - map->base_tsn; 177 177 sctp_tsnmap_find_gap_ack(map->tsn_map, offset, map->len, 0, 178 - &started, &_start, &ended, &_end); 178 + &started, &start_, &ended, &end_); 179 179 } 180 180 181 181 /* Do we need to check the overflow map? */ ··· 193 193 offset, 194 194 map->len, 195 195 map->len, 196 - &started, &_start, 197 - &ended, &_end); 196 + &started, &start_, 197 + &ended, &end_); 198 198 } 199 199 200 200 /* The Gap Ack Block happens to end at the end of the ··· 202 202 */ 203 203 if (started && !ended) { 204 204 ended++; 205 - _end = map->len + map->len - 1; 205 + end_ = map->len + map->len - 1; 206 206 } 207 207 208 208 /* If we found a Gap Ack Block, return the start and end and ··· 215 215 int gap = map->cumulative_tsn_ack_point - 216 216 map->base_tsn; 217 217 218 - *start = _start - gap; 219 - *end = _end - gap; 218 + *start = start_ - gap; 219 + *end = end_ - gap; 220 220 221 221 /* Move the iterator forward. */ 222 222 iter->start = map->cumulative_tsn_ack_point + *end + 1;
+1 -1
net/tipc/link.c
··· 2383 2383 struct tipc_msg *msg = buf_msg(crs); 2384 2384 2385 2385 if ((msg_user(msg) == MSG_BUNDLER) && split_bundles) { 2386 - u32 msgcount = msg_msgcnt(msg); 2387 2386 struct tipc_msg *m = msg_get_wrapped(msg); 2388 2387 unchar* pos = (unchar*)m; 2389 2388 2389 + msgcount = msg_msgcnt(msg); 2390 2390 while (msgcount--) { 2391 2391 msg_set_seqno(m,msg_seqno(msg)); 2392 2392 tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
+1 -1
net/tipc/name_table.c
··· 501 501 * sequence overlapping with the requested sequence 502 502 */ 503 503 504 - void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) 504 + static void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) 505 505 { 506 506 struct sub_seq *sseq = nseq->sseqs; 507 507
-2
net/tipc/node.c
··· 241 241 char addr_string[16]; 242 242 243 243 if (n_ptr->link_cnt >= 2) { 244 - char addr_string[16]; 245 - 246 244 err("Attempt to create third link to %s\n", 247 245 addr_string_fill(addr_string, n_ptr->addr)); 248 246 return NULL;
-1
net/wanrouter/wanmain.c
··· 46 46 #include <linux/capability.h> 47 47 #include <linux/errno.h> /* return codes */ 48 48 #include <linux/kernel.h> 49 - #include <linux/init.h> 50 49 #include <linux/module.h> /* support for loadable modules */ 51 50 #include <linux/slab.h> /* kmalloc(), kfree() */ 52 51 #include <linux/mm.h>