aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/firewire/fw-ohci.c20
-rw-r--r--drivers/firewire/fw-sbp2.c5
-rw-r--r--drivers/firewire/fw-transaction.c4
-rw-r--r--drivers/firewire/fw-transaction.h2
-rw-r--r--drivers/ieee1394/Kconfig2
-rw-r--r--drivers/ieee1394/sbp2.c5
-rw-r--r--include/net/sctp/sctp.h10
-rw-r--r--include/net/tcp.h2
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c5
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp.c3
-rw-r--r--net/ipv4/tcp_input.c37
-rw-r--r--net/ipv4/tcp_ipv4.c1
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/tcp_ipv6.c1
-rw-r--r--net/key/af_key.c3
-rw-r--r--net/netfilter/nf_conntrack_expect.c5
-rw-r--r--net/sctp/input.c2
-rw-r--r--net/sctp/ipv6.c2
-rw-r--r--net/sctp/sm_make_chunk.c6
-rw-r--r--net/sctp/sm_statefuns.c103
-rw-r--r--net/sctp/socket.c45
-rw-r--r--net/sctp/tsnmap.c14
-rw-r--r--net/tipc/link.c2
-rw-r--r--net/tipc/name_table.c2
-rw-r--r--net/tipc/node.c2
-rw-r--r--net/wanrouter/wanmain.c1
29 files changed, 183 insertions, 113 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index db703758db98..7e427b4c74b5 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -907,6 +907,8 @@ static void bus_reset_tasklet(unsigned long data)
907 int self_id_count, i, j, reg; 907 int self_id_count, i, j, reg;
908 int generation, new_generation; 908 int generation, new_generation;
909 unsigned long flags; 909 unsigned long flags;
910 void *free_rom = NULL;
911 dma_addr_t free_rom_bus = 0;
910 912
911 reg = reg_read(ohci, OHCI1394_NodeID); 913 reg = reg_read(ohci, OHCI1394_NodeID);
912 if (!(reg & OHCI1394_NodeID_idValid)) { 914 if (!(reg & OHCI1394_NodeID_idValid)) {
@@ -970,8 +972,8 @@ static void bus_reset_tasklet(unsigned long data)
970 */ 972 */
971 973
972 if (ohci->next_config_rom != NULL) { 974 if (ohci->next_config_rom != NULL) {
973 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, 975 free_rom = ohci->config_rom;
974 ohci->config_rom, ohci->config_rom_bus); 976 free_rom_bus = ohci->config_rom_bus;
975 ohci->config_rom = ohci->next_config_rom; 977 ohci->config_rom = ohci->next_config_rom;
976 ohci->config_rom_bus = ohci->next_config_rom_bus; 978 ohci->config_rom_bus = ohci->next_config_rom_bus;
977 ohci->next_config_rom = NULL; 979 ohci->next_config_rom = NULL;
@@ -990,6 +992,10 @@ static void bus_reset_tasklet(unsigned long data)
990 992
991 spin_unlock_irqrestore(&ohci->lock, flags); 993 spin_unlock_irqrestore(&ohci->lock, flags);
992 994
995 if (free_rom)
996 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
997 free_rom, free_rom_bus);
998
993 fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, 999 fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation,
994 self_id_count, ohci->self_id_buffer); 1000 self_id_count, ohci->self_id_buffer);
995} 1001}
@@ -1186,7 +1192,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
1186{ 1192{
1187 struct fw_ohci *ohci; 1193 struct fw_ohci *ohci;
1188 unsigned long flags; 1194 unsigned long flags;
1189 int retval = 0; 1195 int retval = -EBUSY;
1190 __be32 *next_config_rom; 1196 __be32 *next_config_rom;
1191 dma_addr_t next_config_rom_bus; 1197 dma_addr_t next_config_rom_bus;
1192 1198
@@ -1240,10 +1246,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
1240 1246
1241 reg_write(ohci, OHCI1394_ConfigROMmap, 1247 reg_write(ohci, OHCI1394_ConfigROMmap,
1242 ohci->next_config_rom_bus); 1248 ohci->next_config_rom_bus);
1243 } else { 1249 retval = 0;
1244 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
1245 next_config_rom, next_config_rom_bus);
1246 retval = -EBUSY;
1247 } 1250 }
1248 1251
1249 spin_unlock_irqrestore(&ohci->lock, flags); 1252 spin_unlock_irqrestore(&ohci->lock, flags);
@@ -1257,6 +1260,9 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
1257 */ 1260 */
1258 if (retval == 0) 1261 if (retval == 0)
1259 fw_core_initiate_bus_reset(&ohci->card, 1); 1262 fw_core_initiate_bus_reset(&ohci->card, 1);
1263 else
1264 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
1265 next_config_rom, next_config_rom_bus);
1260 1266
1261 return retval; 1267 return retval;
1262} 1268}
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 3e4a369d0057..ba816ef6def1 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -984,6 +984,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
984 struct fw_unit *unit = sd->unit; 984 struct fw_unit *unit = sd->unit;
985 struct fw_device *device = fw_device(unit->device.parent); 985 struct fw_device *device = fw_device(unit->device.parent);
986 struct sbp2_command_orb *orb; 986 struct sbp2_command_orb *orb;
987 unsigned max_payload;
987 988
988 /* 989 /*
989 * Bidirectional commands are not yet implemented, and unknown 990 * Bidirectional commands are not yet implemented, and unknown
@@ -1017,8 +1018,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1017 * specifies the max payload size as 2 ^ (max_payload + 2), so 1018 * specifies the max payload size as 2 ^ (max_payload + 2), so
1018 * if we set this to max_speed + 7, we get the right value. 1019 * if we set this to max_speed + 7, we get the right value.
1019 */ 1020 */
1021 max_payload = min(device->max_speed + 7,
1022 device->card->max_receive - 1);
1020 orb->request.misc = 1023 orb->request.misc =
1021 COMMAND_ORB_MAX_PAYLOAD(device->max_speed + 7) | 1024 COMMAND_ORB_MAX_PAYLOAD(max_payload) |
1022 COMMAND_ORB_SPEED(device->max_speed) | 1025 COMMAND_ORB_SPEED(device->max_speed) |
1023 COMMAND_ORB_NOTIFY; 1026 COMMAND_ORB_NOTIFY;
1024 1027
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 3ce8e2fbe15f..3e1cb12e43cd 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -734,7 +734,7 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
734} 734}
735EXPORT_SYMBOL(fw_core_handle_response); 735EXPORT_SYMBOL(fw_core_handle_response);
736 736
737const struct fw_address_region topology_map_region = 737static const struct fw_address_region topology_map_region =
738 { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, }; 738 { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, };
739 739
740static void 740static void
@@ -772,7 +772,7 @@ static struct fw_address_handler topology_map = {
772 .address_callback = handle_topology_map, 772 .address_callback = handle_topology_map,
773}; 773};
774 774
775const struct fw_address_region registers_region = 775static const struct fw_address_region registers_region =
776 { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, }; 776 { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, };
777 777
778static void 778static void
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 5ceaccd10564..fa7967b57408 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -231,7 +231,7 @@ struct fw_card {
231 unsigned long reset_jiffies; 231 unsigned long reset_jiffies;
232 232
233 unsigned long long guid; 233 unsigned long long guid;
234 int max_receive; 234 unsigned max_receive;
235 int link_speed; 235 int link_speed;
236 int config_rom_generation; 236 int config_rom_generation;
237 237
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
index 8012b3b0ce75..545663ef820b 100644
--- a/drivers/ieee1394/Kconfig
+++ b/drivers/ieee1394/Kconfig
@@ -97,7 +97,7 @@ config IEEE1394_SBP2
97 97
98config IEEE1394_SBP2_PHYS_DMA 98config IEEE1394_SBP2_PHYS_DMA
99 bool "Enable replacement for physical DMA in SBP2" 99 bool "Enable replacement for physical DMA in SBP2"
100 depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL && (X86_32 || PPC_32) 100 depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL
101 help 101 help
102 This builds sbp2 for use with non-OHCI host adapters which do not 102 This builds sbp2 for use with non-OHCI host adapters which do not
103 support physical DMA or for when ohci1394 is run with phys_dma=0. 103 support physical DMA or for when ohci1394 is run with phys_dma=0.
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index e882cb951b47..47dbe8f17e82 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -773,11 +773,6 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)
773 SBP2_ERR("failed to register lower 4GB address range"); 773 SBP2_ERR("failed to register lower 4GB address range");
774 goto failed_alloc; 774 goto failed_alloc;
775 } 775 }
776#else
777 if (dma_set_mask(hi->host->device.parent, DMA_32BIT_MASK)) {
778 SBP2_ERR("failed to set 4GB DMA mask");
779 goto failed_alloc;
780 }
781#endif 776#endif
782 } 777 }
783 778
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 16baef4dab7e..d529045c1679 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -190,6 +190,16 @@ void sctp_assocs_proc_exit(void);
190 190
191 191
192/* 192/*
193 * Module global variables
194 */
195
196 /*
197 * sctp/protocol.c
198 */
199extern struct kmem_cache *sctp_chunk_cachep __read_mostly;
200extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
201
202/*
193 * Section: Macros, externs, and inlines 203 * Section: Macros, externs, and inlines
194 */ 204 */
195 205
diff --git a/include/net/tcp.h b/include/net/tcp.h
index c209361ab74a..185c7ecce4cc 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -281,7 +281,7 @@ extern int tcp_v4_remember_stamp(struct sock *sk);
281 281
282extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 282extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
283 283
284extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, 284extern int tcp_sendmsg(struct kiocb *iocb, struct socket *sock,
285 struct msghdr *msg, size_t size); 285 struct msghdr *msg, size_t size);
286extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags); 286extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags);
287 287
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 06c08e5740fb..e68103475cca 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -831,7 +831,7 @@ const struct proto_ops inet_stream_ops = {
831 .shutdown = inet_shutdown, 831 .shutdown = inet_shutdown,
832 .setsockopt = sock_common_setsockopt, 832 .setsockopt = sock_common_setsockopt,
833 .getsockopt = sock_common_getsockopt, 833 .getsockopt = sock_common_getsockopt,
834 .sendmsg = inet_sendmsg, 834 .sendmsg = tcp_sendmsg,
835 .recvmsg = sock_common_recvmsg, 835 .recvmsg = sock_common_recvmsg,
836 .mmap = sock_no_mmap, 836 .mmap = sock_no_mmap,
837 .sendpage = tcp_sendpage, 837 .sendpage = tcp_sendpage,
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
index 27c7918e442a..b3dd5de9a258 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -294,15 +294,14 @@ static int exp_open(struct inode *inode, struct file *file)
294 struct ct_expect_iter_state *st; 294 struct ct_expect_iter_state *st;
295 int ret; 295 int ret;
296 296
297 st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 297 st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
298 if (st == NULL) 298 if (!st)
299 return -ENOMEM; 299 return -ENOMEM;
300 ret = seq_open(file, &exp_seq_ops); 300 ret = seq_open(file, &exp_seq_ops);
301 if (ret) 301 if (ret)
302 goto out_free; 302 goto out_free;
303 seq = file->private_data; 303 seq = file->private_data;
304 seq->private = st; 304 seq->private = st;
305 memset(st, 0, sizeof(struct ct_expect_iter_state));
306 return ret; 305 return ret;
307out_free: 306out_free:
308 kfree(st); 307 kfree(st);
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 24d7c9f31918..c6d71526f625 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -900,8 +900,9 @@ static int raw_seq_open(struct inode *inode, struct file *file)
900{ 900{
901 struct seq_file *seq; 901 struct seq_file *seq;
902 int rc = -ENOMEM; 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 if (!s) 906 if (!s)
906 goto out; 907 goto out;
907 rc = seq_open(file, &raw_seq_ops); 908 rc = seq_open(file, &raw_seq_ops);
@@ -910,7 +911,6 @@ static int raw_seq_open(struct inode *inode, struct file *file)
910 911
911 seq = file->private_data; 912 seq = file->private_data;
912 seq->private = s; 913 seq->private = s;
913 memset(s, 0, sizeof(*s));
914out: 914out:
915 return rc; 915 return rc;
916out_kfree: 916out_kfree:
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index df42b7fb3268..c7ca94bd152c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -374,8 +374,9 @@ static int rt_cache_seq_open(struct inode *inode, struct file *file)
374{ 374{
375 struct seq_file *seq; 375 struct seq_file *seq;
376 int rc = -ENOMEM; 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 if (!s) 380 if (!s)
380 goto out; 381 goto out;
381 rc = seq_open(file, &rt_cache_seq_ops); 382 rc = seq_open(file, &rt_cache_seq_ops);
@@ -383,7 +384,6 @@ static int rt_cache_seq_open(struct inode *inode, struct file *file)
383 goto out_kfree; 384 goto out_kfree;
384 seq = file->private_data; 385 seq = file->private_data;
385 seq->private = s; 386 seq->private = s;
386 memset(s, 0, sizeof(*s));
387out: 387out:
388 return rc; 388 return rc;
389out_kfree: 389out_kfree:
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index da4c0b6ab79a..7e740112b238 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -658,9 +658,10 @@ static inline int select_size(struct sock *sk)
658 return tmp; 658 return tmp;
659} 659}
660 660
661int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 661int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
662 size_t size) 662 size_t size)
663{ 663{
664 struct sock *sk = sock->sk;
664 struct iovec *iov; 665 struct iovec *iov;
665 struct tcp_sock *tp = tcp_sk(sk); 666 struct tcp_sock *tp = tcp_sk(sk);
666 struct sk_buff *skb; 667 struct sk_buff *skb;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 378ca8a086a3..f030435e0eb4 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -102,11 +102,14 @@ int sysctl_tcp_abc __read_mostly;
102#define FLAG_DATA_LOST 0x80 /* SACK detected data lossage. */ 102#define FLAG_DATA_LOST 0x80 /* SACK detected data lossage. */
103#define FLAG_SLOWPATH 0x100 /* Do not skip RFC checks for window update.*/ 103#define FLAG_SLOWPATH 0x100 /* Do not skip RFC checks for window update.*/
104#define FLAG_ONLY_ORIG_SACKED 0x200 /* SACKs only non-rexmit sent before RTO */ 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#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) 108#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
107#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) 109#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
108#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE) 110#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE)
109#define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) 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#define IsReno(tp) ((tp)->rx_opt.sack_ok == 0) 114#define IsReno(tp) ((tp)->rx_opt.sack_ok == 0)
112#define IsFack(tp) ((tp)->rx_opt.sack_ok & 2) 115#define IsFack(tp) ((tp)->rx_opt.sack_ok & 2)
@@ -964,12 +967,14 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
964 967
965 /* Check for D-SACK. */ 968 /* Check for D-SACK. */
966 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) { 969 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) {
970 flag |= FLAG_DSACKING_ACK;
967 found_dup_sack = 1; 971 found_dup_sack = 1;
968 tp->rx_opt.sack_ok |= 4; 972 tp->rx_opt.sack_ok |= 4;
969 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); 973 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
970 } else if (num_sacks > 1 && 974 } else if (num_sacks > 1 &&
971 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) && 975 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) &&
972 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) { 976 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) {
977 flag |= FLAG_DSACKING_ACK;
973 found_dup_sack = 1; 978 found_dup_sack = 1;
974 tp->rx_opt.sack_ok |= 4; 979 tp->rx_opt.sack_ok |= 4;
975 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV); 980 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
@@ -1856,7 +1861,7 @@ static void tcp_cwnd_down(struct sock *sk, int flag)
1856 struct tcp_sock *tp = tcp_sk(sk); 1861 struct tcp_sock *tp = tcp_sk(sk);
1857 int decr = tp->snd_cwnd_cnt + 1; 1862 int decr = tp->snd_cwnd_cnt + 1;
1858 1863
1859 if ((flag&FLAG_FORWARD_PROGRESS) || 1864 if ((flag&(FLAG_ANY_PROGRESS|FLAG_DSACKING_ACK)) ||
1860 (IsReno(tp) && !(flag&FLAG_NOT_DUP))) { 1865 (IsReno(tp) && !(flag&FLAG_NOT_DUP))) {
1861 tp->snd_cwnd_cnt = decr&1; 1866 tp->snd_cwnd_cnt = decr&1;
1862 decr >>= 1; 1867 decr >>= 1;
@@ -2107,15 +2112,13 @@ static void tcp_mtup_probe_success(struct sock *sk, struct sk_buff *skb)
2107 * tcp_xmit_retransmit_queue(). 2112 * tcp_xmit_retransmit_queue().
2108 */ 2113 */
2109static void 2114static void
2110tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, 2115tcp_fastretrans_alert(struct sock *sk, int prior_packets, int flag)
2111 int prior_packets, int flag)
2112{ 2116{
2113 struct inet_connection_sock *icsk = inet_csk(sk); 2117 struct inet_connection_sock *icsk = inet_csk(sk);
2114 struct tcp_sock *tp = tcp_sk(sk); 2118 struct tcp_sock *tp = tcp_sk(sk);
2115 int is_dupack = (tp->snd_una == prior_snd_una && 2119 int is_dupack = !(flag&(FLAG_SND_UNA_ADVANCED|FLAG_NOT_DUP));
2116 (!(flag&FLAG_NOT_DUP) || 2120 int do_lost = is_dupack || ((flag&FLAG_DATA_SACKED) &&
2117 ((flag&FLAG_DATA_SACKED) && 2121 (tp->fackets_out > tp->reordering));
2118 (tp->fackets_out > tp->reordering))));
2119 2122
2120 /* Some technical things: 2123 /* Some technical things:
2121 * 1. Reno does not count dupacks (sacked_out) automatically. */ 2124 * 1. Reno does not count dupacks (sacked_out) automatically. */
@@ -2192,14 +2195,14 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2192 /* F. Process state. */ 2195 /* F. Process state. */
2193 switch (icsk->icsk_ca_state) { 2196 switch (icsk->icsk_ca_state) {
2194 case TCP_CA_Recovery: 2197 case TCP_CA_Recovery:
2195 if (prior_snd_una == tp->snd_una) { 2198 if (!(flag & FLAG_SND_UNA_ADVANCED)) {
2196 if (IsReno(tp) && is_dupack) 2199 if (IsReno(tp) && is_dupack)
2197 tcp_add_reno_sack(sk); 2200 tcp_add_reno_sack(sk);
2198 } else { 2201 } else {
2199 int acked = prior_packets - tp->packets_out; 2202 int acked = prior_packets - tp->packets_out;
2200 if (IsReno(tp)) 2203 if (IsReno(tp))
2201 tcp_remove_reno_sacks(sk, acked); 2204 tcp_remove_reno_sacks(sk, acked);
2202 is_dupack = tcp_try_undo_partial(sk, acked); 2205 do_lost = tcp_try_undo_partial(sk, acked);
2203 } 2206 }
2204 break; 2207 break;
2205 case TCP_CA_Loss: 2208 case TCP_CA_Loss:
@@ -2215,7 +2218,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2215 /* Loss is undone; fall through to processing in Open state. */ 2218 /* Loss is undone; fall through to processing in Open state. */
2216 default: 2219 default:
2217 if (IsReno(tp)) { 2220 if (IsReno(tp)) {
2218 if (tp->snd_una != prior_snd_una) 2221 if (flag & FLAG_SND_UNA_ADVANCED)
2219 tcp_reset_reno_sack(tp); 2222 tcp_reset_reno_sack(tp);
2220 if (is_dupack) 2223 if (is_dupack)
2221 tcp_add_reno_sack(sk); 2224 tcp_add_reno_sack(sk);
@@ -2264,7 +2267,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2264 tcp_set_ca_state(sk, TCP_CA_Recovery); 2267 tcp_set_ca_state(sk, TCP_CA_Recovery);
2265 } 2268 }
2266 2269
2267 if (is_dupack || tcp_head_timedout(sk)) 2270 if (do_lost || tcp_head_timedout(sk))
2268 tcp_update_scoreboard(sk); 2271 tcp_update_scoreboard(sk);
2269 tcp_cwnd_down(sk, flag); 2272 tcp_cwnd_down(sk, flag);
2270 tcp_xmit_retransmit_queue(sk); 2273 tcp_xmit_retransmit_queue(sk);
@@ -2684,7 +2687,7 @@ static void tcp_undo_spur_to_response(struct sock *sk, int flag)
2684 * to prove that the RTO is indeed spurious. It transfers the control 2687 * to prove that the RTO is indeed spurious. It transfers the control
2685 * from F-RTO to the conventional RTO recovery 2688 * from F-RTO to the conventional RTO recovery
2686 */ 2689 */
2687static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag) 2690static int tcp_process_frto(struct sock *sk, int flag)
2688{ 2691{
2689 struct tcp_sock *tp = tcp_sk(sk); 2692 struct tcp_sock *tp = tcp_sk(sk);
2690 2693
@@ -2704,8 +2707,7 @@ static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag)
2704 * ACK isn't duplicate nor advances window, e.g., opposite dir 2707 * ACK isn't duplicate nor advances window, e.g., opposite dir
2705 * data, winupdate 2708 * data, winupdate
2706 */ 2709 */
2707 if ((tp->snd_una == prior_snd_una) && (flag&FLAG_NOT_DUP) && 2710 if (!(flag&FLAG_ANY_PROGRESS) && (flag&FLAG_NOT_DUP))
2708 !(flag&FLAG_FORWARD_PROGRESS))
2709 return 1; 2711 return 1;
2710 2712
2711 if (!(flag&FLAG_DATA_ACKED)) { 2713 if (!(flag&FLAG_DATA_ACKED)) {
@@ -2785,6 +2787,9 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
2785 if (before(ack, prior_snd_una)) 2787 if (before(ack, prior_snd_una))
2786 goto old_ack; 2788 goto old_ack;
2787 2789
2790 if (after(ack, prior_snd_una))
2791 flag |= FLAG_SND_UNA_ADVANCED;
2792
2788 if (sysctl_tcp_abc) { 2793 if (sysctl_tcp_abc) {
2789 if (icsk->icsk_ca_state < TCP_CA_CWR) 2794 if (icsk->icsk_ca_state < TCP_CA_CWR)
2790 tp->bytes_acked += ack - prior_snd_una; 2795 tp->bytes_acked += ack - prior_snd_una;
@@ -2837,14 +2842,14 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
2837 flag |= tcp_clean_rtx_queue(sk, &seq_rtt); 2842 flag |= tcp_clean_rtx_queue(sk, &seq_rtt);
2838 2843
2839 if (tp->frto_counter) 2844 if (tp->frto_counter)
2840 frto_cwnd = tcp_process_frto(sk, prior_snd_una, flag); 2845 frto_cwnd = tcp_process_frto(sk, flag);
2841 2846
2842 if (tcp_ack_is_dubious(sk, flag)) { 2847 if (tcp_ack_is_dubious(sk, flag)) {
2843 /* Advance CWND, if state allows this. */ 2848 /* Advance CWND, if state allows this. */
2844 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd && 2849 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd &&
2845 tcp_may_raise_cwnd(sk, flag)) 2850 tcp_may_raise_cwnd(sk, flag))
2846 tcp_cong_avoid(sk, ack, prior_in_flight, 0); 2851 tcp_cong_avoid(sk, ack, prior_in_flight, 0);
2847 tcp_fastretrans_alert(sk, prior_snd_una, prior_packets, flag); 2852 tcp_fastretrans_alert(sk, prior_packets, flag);
2848 } else { 2853 } else {
2849 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd) 2854 if ((flag & FLAG_DATA_ACKED) && !frto_cwnd)
2850 tcp_cong_avoid(sk, ack, prior_in_flight, 1); 2855 tcp_cong_avoid(sk, ack, prior_in_flight, 1);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 3f5f7423b95c..9c94627c8c7e 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2425,7 +2425,6 @@ struct proto tcp_prot = {
2425 .shutdown = tcp_shutdown, 2425 .shutdown = tcp_shutdown,
2426 .setsockopt = tcp_setsockopt, 2426 .setsockopt = tcp_setsockopt,
2427 .getsockopt = tcp_getsockopt, 2427 .getsockopt = tcp_getsockopt,
2428 .sendmsg = tcp_sendmsg,
2429 .recvmsg = tcp_recvmsg, 2428 .recvmsg = tcp_recvmsg,
2430 .backlog_rcv = tcp_v4_do_rcv, 2429 .backlog_rcv = tcp_v4_do_rcv,
2431 .hash = tcp_v4_hash, 2430 .hash = tcp_v4_hash,
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index eed09373a45d..b5f96372ad73 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -484,7 +484,7 @@ const struct proto_ops inet6_stream_ops = {
484 .shutdown = inet_shutdown, /* ok */ 484 .shutdown = inet_shutdown, /* ok */
485 .setsockopt = sock_common_setsockopt, /* ok */ 485 .setsockopt = sock_common_setsockopt, /* ok */
486 .getsockopt = sock_common_getsockopt, /* ok */ 486 .getsockopt = sock_common_getsockopt, /* ok */
487 .sendmsg = inet_sendmsg, /* ok */ 487 .sendmsg = tcp_sendmsg, /* ok */
488 .recvmsg = sock_common_recvmsg, /* ok */ 488 .recvmsg = sock_common_recvmsg, /* ok */
489 .mmap = sock_no_mmap, 489 .mmap = sock_no_mmap,
490 .sendpage = tcp_sendpage, 490 .sendpage = tcp_sendpage,
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index f10f3689d671..cbdb78487915 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2115,7 +2115,6 @@ struct proto tcpv6_prot = {
2115 .shutdown = tcp_shutdown, 2115 .shutdown = tcp_shutdown,
2116 .setsockopt = tcp_setsockopt, 2116 .setsockopt = tcp_setsockopt,
2117 .getsockopt = tcp_getsockopt, 2117 .getsockopt = tcp_getsockopt,
2118 .sendmsg = tcp_sendmsg,
2119 .recvmsg = tcp_recvmsg, 2118 .recvmsg = tcp_recvmsg,
2120 .backlog_rcv = tcp_v6_do_rcv, 2119 .backlog_rcv = tcp_v6_do_rcv,
2121 .hash = tcp_v6_hash, 2120 .hash = tcp_v6_hash,
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 7b0a95abe934..5502df115a63 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1206,6 +1206,9 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
1206 x->sel.prefixlen_s = addr->sadb_address_prefixlen; 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 if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) { 1212 if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) {
1210 struct sadb_x_nat_t_type* n_type; 1213 struct sadb_x_nat_t_type* n_type;
1211 struct xfrm_encap_tmpl *natt; 1214 struct xfrm_encap_tmpl *natt;
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index eb6695dcd73b..3ac64e25f10c 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -477,15 +477,14 @@ static int exp_open(struct inode *inode, struct file *file)
477 struct ct_expect_iter_state *st; 477 struct ct_expect_iter_state *st;
478 int ret; 478 int ret;
479 479
480 st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL); 480 st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
481 if (st == NULL) 481 if (!st)
482 return -ENOMEM; 482 return -ENOMEM;
483 ret = seq_open(file, &exp_seq_ops); 483 ret = seq_open(file, &exp_seq_ops);
484 if (ret) 484 if (ret)
485 goto out_free; 485 goto out_free;
486 seq = file->private_data; 486 seq = file->private_data;
487 seq->private = st; 487 seq->private = st;
488 memset(st, 0, sizeof(struct ct_expect_iter_state));
489 return ret; 488 return ret;
490out_free: 489out_free:
491 kfree(st); 490 kfree(st);
diff --git a/net/sctp/input.c b/net/sctp/input.c
index d57ff7f3c576..47e56017f4ce 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -590,7 +590,7 @@ out_unlock:
590 * Return 0 - If further processing is needed. 590 * Return 0 - If further processing is needed.
591 * Return 1 - If the packet can be discarded right away. 591 * Return 1 - If the packet can be discarded right away.
592 */ 592 */
593int sctp_rcv_ootb(struct sk_buff *skb) 593static int sctp_rcv_ootb(struct sk_buff *skb)
594{ 594{
595 sctp_chunkhdr_t *ch; 595 sctp_chunkhdr_t *ch;
596 __u8 *ch_end; 596 __u8 *ch_end;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 2c29394fd92e..f8aa23dda1c1 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -641,6 +641,8 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
641 newsctp6sk = (struct sctp6_sock *)newsk; 641 newsctp6sk = (struct sctp6_sock *)newsk;
642 inet_sk(newsk)->pinet6 = &newsctp6sk->inet6; 642 inet_sk(newsk)->pinet6 = &newsctp6sk->inet6;
643 643
644 sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped;
645
644 newinet = inet_sk(newsk); 646 newinet = inet_sk(newsk);
645 newnp = inet6_sk(newsk); 647 newnp = inet6_sk(newsk);
646 648
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 8d18f570c2e6..51c4d7fef1d2 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -65,8 +65,6 @@
65#include <net/sctp/sctp.h> 65#include <net/sctp/sctp.h>
66#include <net/sctp/sm.h> 66#include <net/sctp/sm.h>
67 67
68extern struct kmem_cache *sctp_chunk_cachep;
69
70SCTP_STATIC 68SCTP_STATIC
71struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc, 69struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc,
72 __u8 type, __u8 flags, int paylen); 70 __u8 type, __u8 flags, int paylen);
@@ -115,15 +113,12 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code,
115 const void *payload, size_t paylen) 113 const void *payload, size_t paylen)
116{ 114{
117 sctp_errhdr_t err; 115 sctp_errhdr_t err;
118 int padlen;
119 __u16 len; 116 __u16 len;
120 117
121 /* Cause code constants are now defined in network order. */ 118 /* Cause code constants are now defined in network order. */
122 err.cause = cause_code; 119 err.cause = cause_code;
123 len = sizeof(sctp_errhdr_t) + paylen; 120 len = sizeof(sctp_errhdr_t) + paylen;
124 padlen = len % 4;
125 err.length = htons(len); 121 err.length = htons(len);
126 len += padlen;
127 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); 122 chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err);
128 sctp_addto_chunk(chunk, paylen, payload); 123 sctp_addto_chunk(chunk, paylen, payload);
129} 124}
@@ -1454,7 +1449,6 @@ no_hmac:
1454 do_gettimeofday(&tv); 1449 do_gettimeofday(&tv);
1455 1450
1456 if (!asoc && tv_lt(bear_cookie->expiration, tv)) { 1451 if (!asoc && tv_lt(bear_cookie->expiration, tv)) {
1457 __u16 len;
1458 /* 1452 /*
1459 * Section 3.3.10.3 Stale Cookie Error (3) 1453 * Section 3.3.10.3 Stale Cookie Error (3)
1460 * 1454 *
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index fd2dfdd7d7fd..71cad56dd73f 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -97,6 +97,13 @@ static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,
97 const struct sctp_association *asoc, 97 const struct sctp_association *asoc,
98 struct sctp_transport *transport); 98 struct sctp_transport *transport);
99 99
100static 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
100static sctp_disposition_t sctp_sf_violation_chunklen( 107static sctp_disposition_t sctp_sf_violation_chunklen(
101 const struct sctp_endpoint *ep, 108 const struct sctp_endpoint *ep,
102 const struct sctp_association *asoc, 109 const struct sctp_association *asoc,
@@ -104,6 +111,13 @@ static sctp_disposition_t sctp_sf_violation_chunklen(
104 void *arg, 111 void *arg,
105 sctp_cmd_seq_t *commands); 112 sctp_cmd_seq_t *commands);
106 113
114static sctp_disposition_t sctp_sf_violation_ctsn(
115 const struct sctp_endpoint *ep,
116 const struct sctp_association *asoc,
117 const sctp_subtype_t type,
118 void *arg,
119 sctp_cmd_seq_t *commands);
120
107/* Small helper function that checks if the chunk length 121/* Small helper function that checks if the chunk length
108 * is of the appropriate length. The 'required_length' argument 122 * is of the appropriate length. The 'required_length' argument
109 * is set to be the size of a specific chunk we are testing. 123 * is set to be the size of a specific chunk we are testing.
@@ -2880,6 +2894,13 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(const struct sctp_endpoint *ep,
2880 return SCTP_DISPOSITION_DISCARD; 2894 return SCTP_DISPOSITION_DISCARD;
2881 } 2895 }
2882 2896
2897 /* If Cumulative TSN Ack beyond the max tsn currently
2898 * send, terminating the association and respond to the
2899 * sender with an ABORT.
2900 */
2901 if (!TSN_lt(ctsn, asoc->next_tsn))
2902 return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands);
2903
2883 /* Return this SACK for further processing. */ 2904 /* Return this SACK for further processing. */
2884 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh)); 2905 sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh));
2885 2906
@@ -3691,40 +3712,21 @@ sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep,
3691 return SCTP_DISPOSITION_VIOLATION; 3712 return SCTP_DISPOSITION_VIOLATION;
3692} 3713}
3693 3714
3694
3695/* 3715/*
3696 * Handle a protocol violation when the chunk length is invalid. 3716 * Common function to handle a protocol violation.
3697 * "Invalid" length is identified as smaller then the minimal length a
3698 * given chunk can be. For example, a SACK chunk has invalid length
3699 * if it's length is set to be smaller then the size of sctp_sack_chunk_t.
3700 *
3701 * We inform the other end by sending an ABORT with a Protocol Violation
3702 * error code.
3703 *
3704 * Section: Not specified
3705 * Verification Tag: Nothing to do
3706 * Inputs
3707 * (endpoint, asoc, chunk)
3708 *
3709 * Outputs
3710 * (reply_msg, msg_up, counters)
3711 *
3712 * Generate an ABORT chunk and terminate the association.
3713 */ 3717 */
3714static sctp_disposition_t sctp_sf_violation_chunklen( 3718static sctp_disposition_t sctp_sf_abort_violation(
3715 const struct sctp_endpoint *ep,
3716 const struct sctp_association *asoc, 3719 const struct sctp_association *asoc,
3717 const sctp_subtype_t type,
3718 void *arg, 3720 void *arg,
3719 sctp_cmd_seq_t *commands) 3721 sctp_cmd_seq_t *commands,
3722 const __u8 *payload,
3723 const size_t paylen)
3720{ 3724{
3721 struct sctp_chunk *chunk = arg; 3725 struct sctp_chunk *chunk = arg;
3722 struct sctp_chunk *abort = NULL; 3726 struct sctp_chunk *abort = NULL;
3723 char err_str[]="The following chunk had invalid length:";
3724 3727
3725 /* Make the abort chunk. */ 3728 /* Make the abort chunk. */
3726 abort = sctp_make_abort_violation(asoc, chunk, err_str, 3729 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
3727 sizeof(err_str));
3728 if (!abort) 3730 if (!abort)
3729 goto nomem; 3731 goto nomem;
3730 3732
@@ -3756,6 +3758,57 @@ nomem:
3756 return SCTP_DISPOSITION_NOMEM; 3758 return SCTP_DISPOSITION_NOMEM;
3757} 3759}
3758 3760
3761/*
3762 * Handle a protocol violation when the chunk length is invalid.
3763 * "Invalid" length is identified as smaller then the minimal length a
3764 * given chunk can be. For example, a SACK chunk has invalid length
3765 * if it's length is set to be smaller then the size of sctp_sack_chunk_t.
3766 *
3767 * We inform the other end by sending an ABORT with a Protocol Violation
3768 * error code.
3769 *
3770 * Section: Not specified
3771 * Verification Tag: Nothing to do
3772 * Inputs
3773 * (endpoint, asoc, chunk)
3774 *
3775 * Outputs
3776 * (reply_msg, msg_up, counters)
3777 *
3778 * Generate an ABORT chunk and terminate the association.
3779 */
3780static sctp_disposition_t sctp_sf_violation_chunklen(
3781 const struct sctp_endpoint *ep,
3782 const struct sctp_association *asoc,
3783 const sctp_subtype_t type,
3784 void *arg,
3785 sctp_cmd_seq_t *commands)
3786{
3787 char err_str[]="The following chunk had invalid length:";
3788
3789 return sctp_sf_abort_violation(asoc, arg, commands, err_str,
3790 sizeof(err_str));
3791}
3792
3793/* Handle a protocol violation when the peer trying to advance the
3794 * cumulative tsn ack to a point beyond the max tsn currently sent.
3795 *
3796 * We inform the other end by sending an ABORT with a Protocol Violation
3797 * error code.
3798 */
3799static sctp_disposition_t sctp_sf_violation_ctsn(
3800 const struct sctp_endpoint *ep,
3801 const struct sctp_association *asoc,
3802 const sctp_subtype_t type,
3803 void *arg,
3804 sctp_cmd_seq_t *commands)
3805{
3806 char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:";
3807
3808 return sctp_sf_abort_violation(asoc, arg, commands, err_str,
3809 sizeof(err_str));
3810}
3811
3759/*************************************************************************** 3812/***************************************************************************
3760 * These are the state functions for handling primitive (Section 10) events. 3813 * These are the state functions for handling primitive (Section 10) events.
3761 ***************************************************************************/ 3814 ***************************************************************************/
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index ee88f2ea5101..01c6364245b7 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -107,8 +107,6 @@ static void sctp_sock_migrate(struct sock *, struct sock *,
107 struct sctp_association *, sctp_socket_type_t); 107 struct sctp_association *, sctp_socket_type_t);
108static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG; 108static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG;
109 109
110extern struct kmem_cache *sctp_bucket_cachep;
111
112/* Get the sndbuf space available at the time on the association. */ 110/* Get the sndbuf space available at the time on the association. */
113static inline int sctp_wspace(struct sctp_association *asoc) 111static inline int sctp_wspace(struct sctp_association *asoc)
114{ 112{
@@ -433,7 +431,7 @@ out:
433 * 431 *
434 * Only sctp_setsockopt_bindx() is supposed to call this function. 432 * Only sctp_setsockopt_bindx() is supposed to call this function.
435 */ 433 */
436int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) 434static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt)
437{ 435{
438 int cnt; 436 int cnt;
439 int retval = 0; 437 int retval = 0;
@@ -602,7 +600,7 @@ out:
602 * 600 *
603 * Only sctp_setsockopt_bindx() is supposed to call this function. 601 * Only sctp_setsockopt_bindx() is supposed to call this function.
604 */ 602 */
605int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) 603static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
606{ 604{
607 struct sctp_sock *sp = sctp_sk(sk); 605 struct sctp_sock *sp = sctp_sk(sk);
608 struct sctp_endpoint *ep = sp->ep; 606 struct sctp_endpoint *ep = sp->ep;
@@ -977,7 +975,7 @@ static int __sctp_connect(struct sock* sk,
977 int err = 0; 975 int err = 0;
978 int addrcnt = 0; 976 int addrcnt = 0;
979 int walk_size = 0; 977 int walk_size = 0;
980 union sctp_addr *sa_addr; 978 union sctp_addr *sa_addr = NULL;
981 void *addr_buf; 979 void *addr_buf;
982 unsigned short port; 980 unsigned short port;
983 unsigned int f_flags = 0; 981 unsigned int f_flags = 0;
@@ -1011,7 +1009,10 @@ static int __sctp_connect(struct sock* sk,
1011 goto out_free; 1009 goto out_free;
1012 } 1010 }
1013 1011
1014 err = sctp_verify_addr(sk, sa_addr, af->sockaddr_len); 1012 /* Save current address so we can work with it */
1013 memcpy(&to, sa_addr, af->sockaddr_len);
1014
1015 err = sctp_verify_addr(sk, &to, af->sockaddr_len);
1015 if (err) 1016 if (err)
1016 goto out_free; 1017 goto out_free;
1017 1018
@@ -1021,12 +1022,11 @@ static int __sctp_connect(struct sock* sk,
1021 if (asoc && asoc->peer.port && asoc->peer.port != port) 1022 if (asoc && asoc->peer.port && asoc->peer.port != port)
1022 goto out_free; 1023 goto out_free;
1023 1024
1024 memcpy(&to, sa_addr, af->sockaddr_len);
1025 1025
1026 /* Check if there already is a matching association on the 1026 /* Check if there already is a matching association on the
1027 * endpoint (other than the one created here). 1027 * endpoint (other than the one created here).
1028 */ 1028 */
1029 asoc2 = sctp_endpoint_lookup_assoc(ep, sa_addr, &transport); 1029 asoc2 = sctp_endpoint_lookup_assoc(ep, &to, &transport);
1030 if (asoc2 && asoc2 != asoc) { 1030 if (asoc2 && asoc2 != asoc) {
1031 if (asoc2->state >= SCTP_STATE_ESTABLISHED) 1031 if (asoc2->state >= SCTP_STATE_ESTABLISHED)
1032 err = -EISCONN; 1032 err = -EISCONN;
@@ -1039,7 +1039,7 @@ static int __sctp_connect(struct sock* sk,
1039 * make sure that there is no peeled-off association matching 1039 * make sure that there is no peeled-off association matching
1040 * the peer address even on another socket. 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 err = -EADDRNOTAVAIL; 1043 err = -EADDRNOTAVAIL;
1044 goto out_free; 1044 goto out_free;
1045 } 1045 }
@@ -1070,7 +1070,7 @@ static int __sctp_connect(struct sock* sk,
1070 } 1070 }
1071 } 1071 }
1072 1072
1073 scope = sctp_scope(sa_addr); 1073 scope = sctp_scope(&to);
1074 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); 1074 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL);
1075 if (!asoc) { 1075 if (!asoc) {
1076 err = -ENOMEM; 1076 err = -ENOMEM;
@@ -1079,7 +1079,7 @@ static int __sctp_connect(struct sock* sk,
1079 } 1079 }
1080 1080
1081 /* Prime the peer's transport structures. */ 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 SCTP_UNKNOWN); 1083 SCTP_UNKNOWN);
1084 if (!transport) { 1084 if (!transport) {
1085 err = -ENOMEM; 1085 err = -ENOMEM;
@@ -1103,8 +1103,8 @@ static int __sctp_connect(struct sock* sk,
1103 1103
1104 /* Initialize sk's dport and daddr for getpeername() */ 1104 /* Initialize sk's dport and daddr for getpeername() */
1105 inet_sk(sk)->dport = htons(asoc->peer.port); 1105 inet_sk(sk)->dport = htons(asoc->peer.port);
1106 af = sctp_get_af_specific(to.sa.sa_family); 1106 af = sctp_get_af_specific(sa_addr->sa.sa_family);
1107 af->to_sk_daddr(&to, sk); 1107 af->to_sk_daddr(sa_addr, sk);
1108 sk->sk_err = 0; 1108 sk->sk_err = 0;
1109 1109
1110 /* in-kernel sockets don't generally have a file allocated to them 1110 /* in-kernel sockets don't generally have a file allocated to them
@@ -1531,7 +1531,6 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1531 goto out_unlock; 1531 goto out_unlock;
1532 } 1532 }
1533 if (sinfo_flags & SCTP_ABORT) { 1533 if (sinfo_flags & SCTP_ABORT) {
1534 struct sctp_chunk *chunk;
1535 1534
1536 chunk = sctp_make_abort_user(asoc, msg, msg_len); 1535 chunk = sctp_make_abort_user(asoc, msg, msg_len);
1537 if (!chunk) { 1536 if (!chunk) {
@@ -4353,7 +4352,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4353 space_left, &bytes_copied); 4352 space_left, &bytes_copied);
4354 if (cnt < 0) { 4353 if (cnt < 0) {
4355 err = cnt; 4354 err = cnt;
4356 goto error; 4355 goto error_lock;
4357 } 4356 }
4358 goto copy_getaddrs; 4357 goto copy_getaddrs;
4359 } 4358 }
@@ -4367,7 +4366,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4367 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; 4366 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
4368 if (space_left < addrlen) { 4367 if (space_left < addrlen) {
4369 err = -ENOMEM; /*fixme: right error?*/ 4368 err = -ENOMEM; /*fixme: right error?*/
4370 goto error; 4369 goto error_lock;
4371 } 4370 }
4372 memcpy(buf, &temp, addrlen); 4371 memcpy(buf, &temp, addrlen);
4373 buf += addrlen; 4372 buf += addrlen;
@@ -4381,15 +4380,21 @@ copy_getaddrs:
4381 4380
4382 if (copy_to_user(to, addrs, bytes_copied)) { 4381 if (copy_to_user(to, addrs, bytes_copied)) {
4383 err = -EFAULT; 4382 err = -EFAULT;
4384 goto error; 4383 goto out;
4385 } 4384 }
4386 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) { 4385 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) {
4387 err = -EFAULT; 4386 err = -EFAULT;
4388 goto error; 4387 goto out;
4389 } 4388 }
4390 if (put_user(bytes_copied, optlen)) 4389 if (put_user(bytes_copied, optlen))
4391 err = -EFAULT; 4390 err = -EFAULT;
4392error: 4391
4392 goto out;
4393
4394error_lock:
4395 sctp_read_unlock(addr_lock);
4396
4397out:
4393 kfree(addrs); 4398 kfree(addrs);
4394 return err; 4399 return err;
4395} 4400}
@@ -5964,7 +5969,7 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
5964 return err; 5969 return err;
5965} 5970}
5966 5971
5967void sctp_wait_for_close(struct sock *sk, long timeout) 5972static void sctp_wait_for_close(struct sock *sk, long timeout)
5968{ 5973{
5969 DEFINE_WAIT(wait); 5974 DEFINE_WAIT(wait);
5970 5975
diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
index d3192a1babcc..1ff0daade304 100644
--- a/net/sctp/tsnmap.c
+++ b/net/sctp/tsnmap.c
@@ -161,7 +161,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
161 __u16 *start, __u16 *end) 161 __u16 *start, __u16 *end)
162{ 162{
163 int started, ended; 163 int started, ended;
164 __u16 _start, _end, offset; 164 __u16 start_, end_, offset;
165 165
166 /* We haven't found a gap yet. */ 166 /* We haven't found a gap yet. */
167 started = ended = 0; 167 started = ended = 0;
@@ -175,7 +175,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
175 175
176 offset = iter->start - map->base_tsn; 176 offset = iter->start - map->base_tsn;
177 sctp_tsnmap_find_gap_ack(map->tsn_map, offset, map->len, 0, 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 /* Do we need to check the overflow map? */ 181 /* Do we need to check the overflow map? */
@@ -193,8 +193,8 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
193 offset, 193 offset,
194 map->len, 194 map->len,
195 map->len, 195 map->len,
196 &started, &_start, 196 &started, &start_,
197 &ended, &_end); 197 &ended, &end_);
198 } 198 }
199 199
200 /* The Gap Ack Block happens to end at the end of the 200 /* The Gap Ack Block happens to end at the end of the
@@ -202,7 +202,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
202 */ 202 */
203 if (started && !ended) { 203 if (started && !ended) {
204 ended++; 204 ended++;
205 _end = map->len + map->len - 1; 205 end_ = map->len + map->len - 1;
206 } 206 }
207 207
208 /* If we found a Gap Ack Block, return the start and end and 208 /* If we found a Gap Ack Block, return the start and end and
@@ -215,8 +215,8 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
215 int gap = map->cumulative_tsn_ack_point - 215 int gap = map->cumulative_tsn_ack_point -
216 map->base_tsn; 216 map->base_tsn;
217 217
218 *start = _start - gap; 218 *start = start_ - gap;
219 *end = _end - gap; 219 *end = end_ - gap;
220 220
221 /* Move the iterator forward. */ 221 /* Move the iterator forward. */
222 iter->start = map->cumulative_tsn_ack_point + *end + 1; 222 iter->start = map->cumulative_tsn_ack_point + *end + 1;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 1d674e0848fa..1b17fecee747 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2383,10 +2383,10 @@ void tipc_link_changeover(struct link *l_ptr)
2383 struct tipc_msg *msg = buf_msg(crs); 2383 struct tipc_msg *msg = buf_msg(crs);
2384 2384
2385 if ((msg_user(msg) == MSG_BUNDLER) && split_bundles) { 2385 if ((msg_user(msg) == MSG_BUNDLER) && split_bundles) {
2386 u32 msgcount = msg_msgcnt(msg);
2387 struct tipc_msg *m = msg_get_wrapped(msg); 2386 struct tipc_msg *m = msg_get_wrapped(msg);
2388 unchar* pos = (unchar*)m; 2387 unchar* pos = (unchar*)m;
2389 2388
2389 msgcount = msg_msgcnt(msg);
2390 while (msgcount--) { 2390 while (msgcount--) {
2391 msg_set_seqno(m,msg_seqno(msg)); 2391 msg_set_seqno(m,msg_seqno(msg));
2392 tipc_link_tunnel(l_ptr, &tunnel_hdr, m, 2392 tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index d8473eefcd23..ac7dfdda7973 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -501,7 +501,7 @@ end_node:
501 * sequence overlapping with the requested sequence 501 * sequence overlapping with the requested sequence
502 */ 502 */
503 503
504void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) 504static void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
505{ 505{
506 struct sub_seq *sseq = nseq->sseqs; 506 struct sub_seq *sseq = nseq->sseqs;
507 507
diff --git a/net/tipc/node.c b/net/tipc/node.c
index e2e452a62ba1..598f4d3a0098 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -241,8 +241,6 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
241 char addr_string[16]; 241 char addr_string[16];
242 242
243 if (n_ptr->link_cnt >= 2) { 243 if (n_ptr->link_cnt >= 2) {
244 char addr_string[16];
245
246 err("Attempt to create third link to %s\n", 244 err("Attempt to create third link to %s\n",
247 addr_string_fill(addr_string, n_ptr->addr)); 245 addr_string_fill(addr_string, n_ptr->addr));
248 return NULL; 246 return NULL;
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 849cc06bd914..9ab31a3ce3ad 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -46,7 +46,6 @@
46#include <linux/capability.h> 46#include <linux/capability.h>
47#include <linux/errno.h> /* return codes */ 47#include <linux/errno.h> /* return codes */
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/init.h>
50#include <linux/module.h> /* support for loadable modules */ 49#include <linux/module.h> /* support for loadable modules */
51#include <linux/slab.h> /* kmalloc(), kfree() */ 50#include <linux/slab.h> /* kmalloc(), kfree() */
52#include <linux/mm.h> 51#include <linux/mm.h>