aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-11-08 10:34:11 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-11-08 10:34:11 -0500
commit3ee783a3e4867ce5691bfa6a818959e88a50f209 (patch)
tree4263289a5f8551500c0c66bbb0c7ab01a4e8e075
parent80c218812786f619c9a1ce50d0e7c32c7afde4de (diff)
parent375d9d71838970030c8e0bf0ac2abcc1a3487df8 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [DECNET]: Endianess fixes (try #2) [TG3]: Fix array overrun in tg3_read_partno(). [NET]: Set truesize in pskb_copy [NETPOLL]: Compute checksum properly in netpoll_send_udp(). [PKT_SCHED] sch_htb: Use hlist_del_init(). [TCP]: Don't use highmem in tcp hash size calculation. [NET]: kconfig, correct traffic shaper
-rw-r--r--drivers/net/Kconfig8
-rw-r--r--drivers/net/tg3.c19
-rw-r--r--net/core/netpoll.c6
-rw-r--r--net/core/skbuff.c1
-rw-r--r--net/decnet/af_decnet.c25
-rw-r--r--net/decnet/dn_nsp_in.c8
-rw-r--r--net/decnet/dn_nsp_out.c2
-rw-r--r--net/decnet/dn_rules.c4
-rw-r--r--net/ipv4/tcp.c4
-rw-r--r--net/sched/sch_htb.c6
10 files changed, 47 insertions, 36 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9cb3ca5806fc..6e863aa9894c 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2833,7 +2833,7 @@ config NET_FC
2833 "SCSI generic support". 2833 "SCSI generic support".
2834 2834
2835config SHAPER 2835config SHAPER
2836 tristate "Traffic Shaper (EXPERIMENTAL)" 2836 tristate "Traffic Shaper (OBSOLETE)"
2837 depends on EXPERIMENTAL 2837 depends on EXPERIMENTAL
2838 ---help--- 2838 ---help---
2839 The traffic shaper is a virtual network device that allows you to 2839 The traffic shaper is a virtual network device that allows you to
@@ -2842,9 +2842,9 @@ config SHAPER
2842 these virtual devices. See 2842 these virtual devices. See
2843 <file:Documentation/networking/shaper.txt> for more information. 2843 <file:Documentation/networking/shaper.txt> for more information.
2844 2844
2845 An alternative to this traffic shaper is the experimental 2845 An alternative to this traffic shaper are traffic schedulers which
2846 Class-Based Queuing (CBQ) scheduling support which you get if you 2846 you'll get if you say Y to "QoS and/or fair queuing" in
2847 say Y to "QoS and/or fair queuing" above. 2847 "Networking options".
2848 2848
2849 To compile this driver as a module, choose M here: the module 2849 To compile this driver as a module, choose M here: the module
2850 will be called shaper. If unsure, say N. 2850 will be called shaper. If unsure, say N.
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8f059b7968bd..06e4f77b0988 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10212,7 +10212,7 @@ skip_phy_reset:
10212static void __devinit tg3_read_partno(struct tg3 *tp) 10212static void __devinit tg3_read_partno(struct tg3 *tp)
10213{ 10213{
10214 unsigned char vpd_data[256]; 10214 unsigned char vpd_data[256];
10215 int i; 10215 unsigned int i;
10216 u32 magic; 10216 u32 magic;
10217 10217
10218 if (tg3_nvram_read_swab(tp, 0x0, &magic)) 10218 if (tg3_nvram_read_swab(tp, 0x0, &magic))
@@ -10258,9 +10258,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
10258 } 10258 }
10259 10259
10260 /* Now parse and find the part number. */ 10260 /* Now parse and find the part number. */
10261 for (i = 0; i < 256; ) { 10261 for (i = 0; i < 254; ) {
10262 unsigned char val = vpd_data[i]; 10262 unsigned char val = vpd_data[i];
10263 int block_end; 10263 unsigned int block_end;
10264 10264
10265 if (val == 0x82 || val == 0x91) { 10265 if (val == 0x82 || val == 0x91) {
10266 i = (i + 3 + 10266 i = (i + 3 +
@@ -10276,21 +10276,26 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
10276 (vpd_data[i + 1] + 10276 (vpd_data[i + 1] +
10277 (vpd_data[i + 2] << 8))); 10277 (vpd_data[i + 2] << 8)));
10278 i += 3; 10278 i += 3;
10279 while (i < block_end) { 10279
10280 if (block_end > 256)
10281 goto out_not_found;
10282
10283 while (i < (block_end - 2)) {
10280 if (vpd_data[i + 0] == 'P' && 10284 if (vpd_data[i + 0] == 'P' &&
10281 vpd_data[i + 1] == 'N') { 10285 vpd_data[i + 1] == 'N') {
10282 int partno_len = vpd_data[i + 2]; 10286 int partno_len = vpd_data[i + 2];
10283 10287
10284 if (partno_len > 24) 10288 i += 3;
10289 if (partno_len > 24 || (partno_len + i) > 256)
10285 goto out_not_found; 10290 goto out_not_found;
10286 10291
10287 memcpy(tp->board_part_number, 10292 memcpy(tp->board_part_number,
10288 &vpd_data[i + 3], 10293 &vpd_data[i], partno_len);
10289 partno_len);
10290 10294
10291 /* Success. */ 10295 /* Success. */
10292 return; 10296 return;
10293 } 10297 }
10298 i += 3 + vpd_data[i + 2];
10294 } 10299 }
10295 10300
10296 /* Part number not found. */ 10301 /* Part number not found. */
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 9308af060b44..6589adb14cbf 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -340,6 +340,12 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
340 udph->dest = htons(np->remote_port); 340 udph->dest = htons(np->remote_port);
341 udph->len = htons(udp_len); 341 udph->len = htons(udp_len);
342 udph->check = 0; 342 udph->check = 0;
343 udph->check = csum_tcpudp_magic(htonl(np->local_ip),
344 htonl(np->remote_ip),
345 udp_len, IPPROTO_UDP,
346 csum_partial((unsigned char *)udph, udp_len, 0));
347 if (udph->check == 0)
348 udph->check = -1;
343 349
344 skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph)); 350 skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph));
345 351
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f735455dc5d1..b8b106358040 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -639,6 +639,7 @@ struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
639 n->csum = skb->csum; 639 n->csum = skb->csum;
640 n->ip_summed = skb->ip_summed; 640 n->ip_summed = skb->ip_summed;
641 641
642 n->truesize += skb->data_len;
642 n->data_len = skb->data_len; 643 n->data_len = skb->data_len;
643 n->len = skb->len; 644 n->len = skb->len;
644 645
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 3456cd331835..21f20f21dd32 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -166,7 +166,7 @@ static struct hlist_head *dn_find_list(struct sock *sk)
166 if (scp->addr.sdn_flags & SDF_WILD) 166 if (scp->addr.sdn_flags & SDF_WILD)
167 return hlist_empty(&dn_wild_sk) ? &dn_wild_sk : NULL; 167 return hlist_empty(&dn_wild_sk) ? &dn_wild_sk : NULL;
168 168
169 return &dn_sk_hash[scp->addrloc & DN_SK_HASH_MASK]; 169 return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK];
170} 170}
171 171
172/* 172/*
@@ -180,7 +180,7 @@ static int check_port(__le16 port)
180 if (port == 0) 180 if (port == 0)
181 return -1; 181 return -1;
182 182
183 sk_for_each(sk, node, &dn_sk_hash[port & DN_SK_HASH_MASK]) { 183 sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(port) & DN_SK_HASH_MASK]) {
184 struct dn_scp *scp = DN_SK(sk); 184 struct dn_scp *scp = DN_SK(sk);
185 if (scp->addrloc == port) 185 if (scp->addrloc == port)
186 return -1; 186 return -1;
@@ -194,12 +194,12 @@ static unsigned short port_alloc(struct sock *sk)
194static unsigned short port = 0x2000; 194static unsigned short port = 0x2000;
195 unsigned short i_port = port; 195 unsigned short i_port = port;
196 196
197 while(check_port(++port) != 0) { 197 while(check_port(dn_htons(++port)) != 0) {
198 if (port == i_port) 198 if (port == i_port)
199 return 0; 199 return 0;
200 } 200 }
201 201
202 scp->addrloc = port; 202 scp->addrloc = dn_htons(port);
203 203
204 return 1; 204 return 1;
205} 205}
@@ -418,7 +418,7 @@ struct sock *dn_find_by_skb(struct sk_buff *skb)
418 struct dn_scp *scp; 418 struct dn_scp *scp;
419 419
420 read_lock(&dn_hash_lock); 420 read_lock(&dn_hash_lock);
421 sk_for_each(sk, node, &dn_sk_hash[cb->dst_port & DN_SK_HASH_MASK]) { 421 sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(cb->dst_port) & DN_SK_HASH_MASK]) {
422 scp = DN_SK(sk); 422 scp = DN_SK(sk);
423 if (cb->src != dn_saddr2dn(&scp->peer)) 423 if (cb->src != dn_saddr2dn(&scp->peer))
424 continue; 424 continue;
@@ -1016,13 +1016,14 @@ static void dn_access_copy(struct sk_buff *skb, struct accessdata_dn *acc)
1016 1016
1017static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt) 1017static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt)
1018{ 1018{
1019 unsigned char *ptr = skb->data; 1019 unsigned char *ptr = skb->data;
1020 1020 u16 len = *ptr++; /* yes, it's 8bit on the wire */
1021 opt->opt_optl = *ptr++; 1021
1022 opt->opt_status = 0; 1022 BUG_ON(len > 16); /* we've checked the contents earlier */
1023 memcpy(opt->opt_data, ptr, opt->opt_optl); 1023 opt->opt_optl = dn_htons(len);
1024 skb_pull(skb, dn_ntohs(opt->opt_optl) + 1); 1024 opt->opt_status = 0;
1025 1025 memcpy(opt->opt_data, ptr, len);
1026 skb_pull(skb, len + 1);
1026} 1027}
1027 1028
1028static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) 1029static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo)
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index 72ecc6e62ec4..7683d4f754d2 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -360,9 +360,9 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb)
360 scp->max_window = decnet_no_fc_max_cwnd; 360 scp->max_window = decnet_no_fc_max_cwnd;
361 361
362 if (skb->len > 0) { 362 if (skb->len > 0) {
363 unsigned char dlen = *skb->data; 363 u16 dlen = *skb->data;
364 if ((dlen <= 16) && (dlen <= skb->len)) { 364 if ((dlen <= 16) && (dlen <= skb->len)) {
365 scp->conndata_in.opt_optl = dn_htons((__u16)dlen); 365 scp->conndata_in.opt_optl = dn_htons(dlen);
366 memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); 366 memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen);
367 } 367 }
368 } 368 }
@@ -404,9 +404,9 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb)
404 memset(scp->discdata_in.opt_data, 0, 16); 404 memset(scp->discdata_in.opt_data, 0, 16);
405 405
406 if (skb->len > 0) { 406 if (skb->len > 0) {
407 unsigned char dlen = *skb->data; 407 u16 dlen = *skb->data;
408 if ((dlen <= 16) && (dlen <= skb->len)) { 408 if ((dlen <= 16) && (dlen <= skb->len)) {
409 scp->discdata_in.opt_optl = dn_htons((__u16)dlen); 409 scp->discdata_in.opt_optl = dn_htons(dlen);
410 memcpy(scp->discdata_in.opt_data, skb->data + 1, dlen); 410 memcpy(scp->discdata_in.opt_data, skb->data + 1, dlen);
411 } 411 }
412 } 412 }
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index c2e21cd89b3c..b342e4e8f5f8 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -526,7 +526,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
526 struct nsp_conn_init_msg *msg; 526 struct nsp_conn_init_msg *msg;
527 __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl); 527 __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl);
528 528
529 if ((skb = dn_alloc_skb(sk, 50 + dn_ntohs(scp->conndata_out.opt_optl), gfp)) == NULL) 529 if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL)
530 return; 530 return;
531 531
532 msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); 532 msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg));
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 3e0c882c90bf..590e0a72495c 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -124,8 +124,8 @@ static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
124static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) 124static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
125{ 125{
126 struct dn_fib_rule *r = (struct dn_fib_rule *)rule; 126 struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
127 u16 daddr = fl->fld_dst; 127 __le16 daddr = fl->fld_dst;
128 u16 saddr = fl->fld_src; 128 __le16 saddr = fl->fld_src;
129 129
130 if (((saddr ^ r->src) & r->srcmask) || 130 if (((saddr ^ r->src) & r->srcmask) ||
131 ((daddr ^ r->dst) & r->dstmask)) 131 ((daddr ^ r->dst) & r->dstmask))
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 66e9a729f6df..4322318ab332 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2270,7 +2270,7 @@ void __init tcp_init(void)
2270 thash_entries, 2270 thash_entries,
2271 (num_physpages >= 128 * 1024) ? 2271 (num_physpages >= 128 * 1024) ?
2272 13 : 15, 2272 13 : 15,
2273 HASH_HIGHMEM, 2273 0,
2274 &tcp_hashinfo.ehash_size, 2274 &tcp_hashinfo.ehash_size,
2275 NULL, 2275 NULL,
2276 0); 2276 0);
@@ -2286,7 +2286,7 @@ void __init tcp_init(void)
2286 tcp_hashinfo.ehash_size, 2286 tcp_hashinfo.ehash_size,
2287 (num_physpages >= 128 * 1024) ? 2287 (num_physpages >= 128 * 1024) ?
2288 13 : 15, 2288 13 : 15,
2289 HASH_HIGHMEM, 2289 0,
2290 &tcp_hashinfo.bhash_size, 2290 &tcp_hashinfo.bhash_size,
2291 NULL, 2291 NULL,
2292 64 * 1024); 2292 64 * 1024);
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 9b9c555c713f..4b52fa78935a 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1284,8 +1284,7 @@ static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl)
1284 struct htb_class, sibling)); 1284 struct htb_class, sibling));
1285 1285
1286 /* note: this delete may happen twice (see htb_delete) */ 1286 /* note: this delete may happen twice (see htb_delete) */
1287 if (!hlist_unhashed(&cl->hlist)) 1287 hlist_del_init(&cl->hlist);
1288 hlist_del(&cl->hlist);
1289 list_del(&cl->sibling); 1288 list_del(&cl->sibling);
1290 1289
1291 if (cl->prio_activity) 1290 if (cl->prio_activity)
@@ -1333,8 +1332,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
1333 sch_tree_lock(sch); 1332 sch_tree_lock(sch);
1334 1333
1335 /* delete from hash and active; remainder in destroy_class */ 1334 /* delete from hash and active; remainder in destroy_class */
1336 if (!hlist_unhashed(&cl->hlist)) 1335 hlist_del_init(&cl->hlist);
1337 hlist_del(&cl->hlist);
1338 1336
1339 if (cl->prio_activity) 1337 if (cl->prio_activity)
1340 htb_deactivate(q, cl); 1338 htb_deactivate(q, cl);