aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-20 20:39:53 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-20 20:39:53 -0400
commita4cfae13cef6a700a04b13ba1d819c0641b1b26f (patch)
tree91aa4f8be6df4494276d1a064d9f8f2b994aa367
parentbe883da7594b0a2a02074e683673ae0e522566a4 (diff)
parentff7512e1a2a3504649d3716a757f43807b6d26ef (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: [ATM]: fix broken uses of NIPQUAD in net/atm [SCTP]: sctp_unpack_cookie() fix [SCTP]: Fix unintentional change to SCTP_ASSERT when !SCTP_DEBUG [NET]: Prevent multiple qdisc runs [CONNECTOR]: Initialize subsystem earlier. [NETFILTER]: xt_sctp: fix endless loop caused by 0 chunk length
-rw-r--r--drivers/connector/connector.c14
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/net/pkt_sched.h7
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--net/atm/mpc.c13
-rw-r--r--net/atm/mpoa_caches.c12
-rw-r--r--net/netfilter/xt_sctp.c2
-rw-r--r--net/sched/sch_generic.c11
-rw-r--r--net/sctp/sm_make_chunk.c4
9 files changed, 34 insertions, 32 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 35897079a78d..79d581c86520 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -308,6 +308,9 @@ int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *))
308 int err; 308 int err;
309 struct cn_dev *dev = &cdev; 309 struct cn_dev *dev = &cdev;
310 310
311 if (!cn_already_initialized)
312 return -EAGAIN;
313
311 err = cn_queue_add_callback(dev->cbdev, name, id, callback); 314 err = cn_queue_add_callback(dev->cbdev, name, id, callback);
312 if (err) 315 if (err)
313 return err; 316 return err;
@@ -435,7 +438,7 @@ static void cn_callback(void *data)
435 mutex_unlock(&notify_lock); 438 mutex_unlock(&notify_lock);
436} 439}
437 440
438static int __init cn_init(void) 441static int __devinit cn_init(void)
439{ 442{
440 struct cn_dev *dev = &cdev; 443 struct cn_dev *dev = &cdev;
441 int err; 444 int err;
@@ -456,21 +459,22 @@ static int __init cn_init(void)
456 sock_release(dev->nls->sk_socket); 459 sock_release(dev->nls->sk_socket);
457 return -EINVAL; 460 return -EINVAL;
458 } 461 }
462
463 cn_already_initialized = 1;
459 464
460 err = cn_add_callback(&dev->id, "connector", &cn_callback); 465 err = cn_add_callback(&dev->id, "connector", &cn_callback);
461 if (err) { 466 if (err) {
467 cn_already_initialized = 0;
462 cn_queue_free_dev(dev->cbdev); 468 cn_queue_free_dev(dev->cbdev);
463 if (dev->nls->sk_socket) 469 if (dev->nls->sk_socket)
464 sock_release(dev->nls->sk_socket); 470 sock_release(dev->nls->sk_socket);
465 return -EINVAL; 471 return -EINVAL;
466 } 472 }
467 473
468 cn_already_initialized = 1;
469
470 return 0; 474 return 0;
471} 475}
472 476
473static void __exit cn_fini(void) 477static void __devexit cn_fini(void)
474{ 478{
475 struct cn_dev *dev = &cdev; 479 struct cn_dev *dev = &cdev;
476 480
@@ -482,7 +486,7 @@ static void __exit cn_fini(void)
482 sock_release(dev->nls->sk_socket); 486 sock_release(dev->nls->sk_socket);
483} 487}
484 488
485module_init(cn_init); 489subsys_initcall(cn_init);
486module_exit(cn_fini); 490module_exit(cn_fini);
487 491
488EXPORT_SYMBOL_GPL(cn_add_callback); 492EXPORT_SYMBOL_GPL(cn_add_callback);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5e8e2d50429a..cead6be467ed 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -232,6 +232,7 @@ enum netdev_state_t
232 __LINK_STATE_RX_SCHED, 232 __LINK_STATE_RX_SCHED,
233 __LINK_STATE_LINKWATCH_PENDING, 233 __LINK_STATE_LINKWATCH_PENDING,
234 __LINK_STATE_DORMANT, 234 __LINK_STATE_DORMANT,
235 __LINK_STATE_QDISC_RUNNING,
235}; 236};
236 237
237 238
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b94d1ad92c4d..75b5b9333fc7 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -218,12 +218,13 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
218 struct rtattr *tab); 218 struct rtattr *tab);
219extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 219extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
220 220
221extern int qdisc_restart(struct net_device *dev); 221extern void __qdisc_run(struct net_device *dev);
222 222
223static inline void qdisc_run(struct net_device *dev) 223static inline void qdisc_run(struct net_device *dev)
224{ 224{
225 while (!netif_queue_stopped(dev) && qdisc_restart(dev) < 0) 225 if (!netif_queue_stopped(dev) &&
226 /* NOTHING */; 226 !test_and_set_bit(__LINK_STATE_QDISC_RUNNING, &dev->state))
227 __qdisc_run(dev);
227} 228}
228 229
229extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, 230extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp,
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 237f82b05e40..a9663b49ea54 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -254,7 +254,7 @@ extern int sctp_debug_flag;
254#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) 254#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
255#define SCTP_ENABLE_DEBUG 255#define SCTP_ENABLE_DEBUG
256#define SCTP_DISABLE_DEBUG 256#define SCTP_DISABLE_DEBUG
257#define SCTP_ASSERT(expr, str, func) BUG_ON(!(expr)) 257#define SCTP_ASSERT(expr, str, func)
258 258
259#endif /* SCTP_DEBUG */ 259#endif /* SCTP_DEBUG */
260 260
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index c304ef1513b9..a48a5d580408 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -229,20 +229,15 @@ int atm_mpoa_delete_qos(struct atm_mpoa_qos *entry)
229/* this is buggered - we need locking for qos_head */ 229/* this is buggered - we need locking for qos_head */
230void atm_mpoa_disp_qos(struct seq_file *m) 230void atm_mpoa_disp_qos(struct seq_file *m)
231{ 231{
232 unsigned char *ip;
233 char ipaddr[16];
234 struct atm_mpoa_qos *qos; 232 struct atm_mpoa_qos *qos;
235 233
236 qos = qos_head; 234 qos = qos_head;
237 seq_printf(m, "QoS entries for shortcuts:\n"); 235 seq_printf(m, "QoS entries for shortcuts:\n");
238 seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n"); 236 seq_printf(m, "IP address\n TX:max_pcr pcr min_pcr max_cdv max_sdu\n RX:max_pcr pcr min_pcr max_cdv max_sdu\n");
239 237
240 ipaddr[sizeof(ipaddr)-1] = '\0';
241 while (qos != NULL) { 238 while (qos != NULL) {
242 ip = (unsigned char *)&qos->ipaddr;
243 sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(ip));
244 seq_printf(m, "%u.%u.%u.%u\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", 239 seq_printf(m, "%u.%u.%u.%u\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n",
245 NIPQUAD(ipaddr), 240 NIPQUAD(qos->ipaddr),
246 qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, 241 qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu,
247 qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); 242 qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu);
248 qos = qos->next; 243 qos = qos->next;
@@ -1083,7 +1078,6 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1083static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) 1078static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry)
1084{ 1079{
1085 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1080 uint32_t dst_ip = msg->content.in_info.in_dst_ip;
1086 unsigned char *ip __attribute__ ((unused)) = (unsigned char *)&dst_ip;
1087 struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip); 1081 struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip);
1088 eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client); 1082 eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client);
1089 1083
@@ -1097,7 +1091,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
1097 entry->shortcut = eg_entry->shortcut; 1091 entry->shortcut = eg_entry->shortcut;
1098 } 1092 }
1099 if(entry->shortcut){ 1093 if(entry->shortcut){
1100 dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(ip)); 1094 dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip));
1101 client->eg_ops->put(eg_entry); 1095 client->eg_ops->put(eg_entry);
1102 return; 1096 return;
1103 } 1097 }
@@ -1123,8 +1117,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1123 1117
1124 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1118 uint32_t dst_ip = msg->content.in_info.in_dst_ip;
1125 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); 1119 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc);
1126 ip = (unsigned char *)&dst_ip; 1120 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip));
1127 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(ip));
1128 ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); 1121 ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry);
1129 if(entry == NULL){ 1122 if(entry == NULL){
1130 printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); 1123 printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name);
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c
index 64ddebb64060..781ed1b9329d 100644
--- a/net/atm/mpoa_caches.c
+++ b/net/atm/mpoa_caches.c
@@ -223,7 +223,6 @@ static void in_cache_remove_entry(in_cache_entry *entry,
223 but an easy one... */ 223 but an easy one... */
224static void clear_count_and_expired(struct mpoa_client *client) 224static void clear_count_and_expired(struct mpoa_client *client)
225{ 225{
226 unsigned char *ip;
227 in_cache_entry *entry, *next_entry; 226 in_cache_entry *entry, *next_entry;
228 struct timeval now; 227 struct timeval now;
229 228
@@ -236,8 +235,7 @@ static void clear_count_and_expired(struct mpoa_client *client)
236 next_entry = entry->next; 235 next_entry = entry->next;
237 if((now.tv_sec - entry->tv.tv_sec) 236 if((now.tv_sec - entry->tv.tv_sec)
238 > entry->ctrl_info.holding_time){ 237 > entry->ctrl_info.holding_time){
239 ip = (unsigned char*)&entry->ctrl_info.in_dst_ip; 238 dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %u.%u.%u.%u\n", NIPQUAD(entry->ctrl_info.in_dst_ip));
240 dprintk("mpoa: mpoa_caches.c: holding time expired, ip = %u.%u.%u.%u\n", NIPQUAD(ip));
241 client->in_ops->remove_entry(entry, client); 239 client->in_ops->remove_entry(entry, client);
242 } 240 }
243 entry = next_entry; 241 entry = next_entry;
@@ -455,7 +453,6 @@ static void eg_cache_remove_entry(eg_cache_entry *entry,
455 453
456static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_client *client) 454static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_client *client)
457{ 455{
458 unsigned char *ip;
459 eg_cache_entry *entry = kmalloc(sizeof(eg_cache_entry), GFP_KERNEL); 456 eg_cache_entry *entry = kmalloc(sizeof(eg_cache_entry), GFP_KERNEL);
460 457
461 if (entry == NULL) { 458 if (entry == NULL) {
@@ -463,8 +460,7 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli
463 return NULL; 460 return NULL;
464 } 461 }
465 462
466 ip = (unsigned char *)&msg->content.eg_info.eg_dst_ip; 463 dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(msg->content.eg_info.eg_dst_ip));
467 dprintk("mpoa: mpoa_caches.c: adding an egress entry, ip = %u.%u.%u.%u, this should be our IP\n", NIPQUAD(ip));
468 memset(entry, 0, sizeof(eg_cache_entry)); 464 memset(entry, 0, sizeof(eg_cache_entry));
469 465
470 atomic_set(&entry->use, 1); 466 atomic_set(&entry->use, 1);
@@ -481,8 +477,8 @@ static eg_cache_entry *eg_cache_add_entry(struct k_message *msg, struct mpoa_cli
481 do_gettimeofday(&(entry->tv)); 477 do_gettimeofday(&(entry->tv));
482 entry->entry_state = EGRESS_RESOLVED; 478 entry->entry_state = EGRESS_RESOLVED;
483 dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id)); 479 dprintk("mpoa: mpoa_caches.c: new_eg_cache_entry cache_id %lu\n", ntohl(entry->ctrl_info.cache_id));
484 ip = (unsigned char *)&entry->ctrl_info.mps_ip; 480 dprintk("mpoa: mpoa_caches.c: mps_ip = %u.%u.%u.%u\n",
485 dprintk("mpoa: mpoa_caches.c: mps_ip = %u.%u.%u.%u\n", NIPQUAD(ip)); 481 NIPQUAD(entry->ctrl_info.mps_ip));
486 atomic_inc(&entry->use); 482 atomic_inc(&entry->use);
487 483
488 write_unlock_irq(&client->egress_lock); 484 write_unlock_irq(&client->egress_lock);
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c
index b5110e5b54b0..9316c753692f 100644
--- a/net/netfilter/xt_sctp.c
+++ b/net/netfilter/xt_sctp.c
@@ -62,7 +62,7 @@ match_packet(const struct sk_buff *skb,
62 62
63 do { 63 do {
64 sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch); 64 sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch);
65 if (sch == NULL) { 65 if (sch == NULL || sch->length == 0) {
66 duprintf("Dropping invalid SCTP packet.\n"); 66 duprintf("Dropping invalid SCTP packet.\n");
67 *hotdrop = 1; 67 *hotdrop = 1;
68 return 0; 68 return 0;
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index b1e4c5e20ac7..d7aca8ef524a 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -90,7 +90,7 @@ void qdisc_unlock_tree(struct net_device *dev)
90 NOTE: Called under dev->queue_lock with locally disabled BH. 90 NOTE: Called under dev->queue_lock with locally disabled BH.
91*/ 91*/
92 92
93int qdisc_restart(struct net_device *dev) 93static inline int qdisc_restart(struct net_device *dev)
94{ 94{
95 struct Qdisc *q = dev->qdisc; 95 struct Qdisc *q = dev->qdisc;
96 struct sk_buff *skb; 96 struct sk_buff *skb;
@@ -179,6 +179,14 @@ requeue:
179 return q->q.qlen; 179 return q->q.qlen;
180} 180}
181 181
182void __qdisc_run(struct net_device *dev)
183{
184 while (qdisc_restart(dev) < 0 && !netif_queue_stopped(dev))
185 /* NOTHING */;
186
187 clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state);
188}
189
182static void dev_watchdog(unsigned long arg) 190static void dev_watchdog(unsigned long arg)
183{ 191{
184 struct net_device *dev = (struct net_device *)arg; 192 struct net_device *dev = (struct net_device *)arg;
@@ -620,6 +628,5 @@ EXPORT_SYMBOL(qdisc_create_dflt);
620EXPORT_SYMBOL(qdisc_alloc); 628EXPORT_SYMBOL(qdisc_alloc);
621EXPORT_SYMBOL(qdisc_destroy); 629EXPORT_SYMBOL(qdisc_destroy);
622EXPORT_SYMBOL(qdisc_reset); 630EXPORT_SYMBOL(qdisc_reset);
623EXPORT_SYMBOL(qdisc_restart);
624EXPORT_SYMBOL(qdisc_lock_tree); 631EXPORT_SYMBOL(qdisc_lock_tree);
625EXPORT_SYMBOL(qdisc_unlock_tree); 632EXPORT_SYMBOL(qdisc_unlock_tree);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 5e0de3c0eead..2a8773691695 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1402,14 +1402,14 @@ struct sctp_association *sctp_unpack_cookie(
1402 sg.length = bodysize; 1402 sg.length = bodysize;
1403 key = (char *)ep->secret_key[ep->current_key]; 1403 key = (char *)ep->secret_key[ep->current_key];
1404 1404
1405 memset(digest, 0x00, sizeof(digest)); 1405 memset(digest, 0x00, SCTP_SIGNATURE_SIZE);
1406 sctp_crypto_hmac(sctp_sk(ep->base.sk)->hmac, key, &keylen, &sg, 1406 sctp_crypto_hmac(sctp_sk(ep->base.sk)->hmac, key, &keylen, &sg,
1407 1, digest); 1407 1, digest);
1408 1408
1409 if (memcmp(digest, cookie->signature, SCTP_SIGNATURE_SIZE)) { 1409 if (memcmp(digest, cookie->signature, SCTP_SIGNATURE_SIZE)) {
1410 /* Try the previous key. */ 1410 /* Try the previous key. */
1411 key = (char *)ep->secret_key[ep->last_key]; 1411 key = (char *)ep->secret_key[ep->last_key];
1412 memset(digest, 0x00, sizeof(digest)); 1412 memset(digest, 0x00, SCTP_SIGNATURE_SIZE);
1413 sctp_crypto_hmac(sctp_sk(ep->base.sk)->hmac, key, &keylen, 1413 sctp_crypto_hmac(sctp_sk(ep->base.sk)->hmac, key, &keylen,
1414 &sg, 1, digest); 1414 &sg, 1, digest);
1415 1415