diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-31 07:46:51 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-31 07:46:51 -0700 |
commit | dd13810b420e0de1fe75bc3b9b14dd2c2c9a4299 (patch) | |
tree | 37598ca7162d5d440ab554a45d6f64347f4e5df4 /net | |
parent | a3634d7169f56eca5e349fce2f1de228fc10efda (diff) | |
parent | 298bb62175a8e8c2f21f3e00543cda853f423599 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
[AF_KEY]: suppress a warning for 64k pages.
[TIPC]: Fix headercheck wrt. tipc_config.h
[COMPAT]: Fix build on COMPAT platforms when CONFIG_NET is disabled.
[CONNECTOR]: Fix a spurious kfree_skb() call
[COMPAT]: Fix new dev_ifname32 returning -EFAULT
[NET]: Fix incorrect sg_mark_end() calls.
[IPVS]: Remove /proc/net/ip_vs_lblcr
[IPV6]: remove duplicate call to proc_net_remove
[NETNS]: fix net released by rcu callback
[NET]: Fix free_netdev on register_netdev failure.
[WAN]: fix drivers/net/wan/lmc/ compilation
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 112 | ||||
-rw-r--r-- | net/core/net_namespace.c | 2 | ||||
-rw-r--r-- | net/core/skbuff.c | 16 | ||||
-rw-r--r-- | net/ipv4/esp4.c | 12 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblcr.c | 76 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 4 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 13 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 2 | ||||
-rw-r--r-- | net/key/af_key.c | 4 | ||||
-rw-r--r-- | net/rxrpc/rxkad.c | 9 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_crypto.c | 6 |
12 files changed, 100 insertions, 158 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 02e7d8377c4..91ece48e127 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3496,6 +3496,60 @@ static void net_set_todo(struct net_device *dev) spin_unlock(&net_todo_list_lock); } +static void rollback_registered(struct net_device *dev) +{ + BUG_ON(dev_boot_phase); + ASSERT_RTNL(); + + /* Some devices call without registering for initialization unwind. */ + if (dev->reg_state == NETREG_UNINITIALIZED) { + printk(KERN_DEBUG "unregister_netdevice: device %s/%p never " + "was registered\n", dev->name, dev); + + WARN_ON(1); + return; + } + + BUG_ON(dev->reg_state != NETREG_REGISTERED); + + /* If device is running, close it first. */ + dev_close(dev); + + /* And unlink it from device chain. */ + unlist_netdevice(dev); + + dev->reg_state = NETREG_UNREGISTERING; + + synchronize_net(); + + /* Shutdown queueing discipline. */ + dev_shutdown(dev); + + + /* Notify protocols, that we are about to destroy + this device. They should clean all the things. + */ + call_netdevice_notifiers(NETDEV_UNREGISTER, dev); + + /* + * Flush the unicast and multicast chains + */ + dev_addr_discard(dev); + + if (dev->uninit) + dev->uninit(dev); + + /* Notifier chain MUST detach us from master device. */ + BUG_TRAP(!dev->master); + + /* Remove entries from kobject tree */ + netdev_unregister_kobject(dev); + + synchronize_net(); + + dev_put(dev); +} + /** * register_netdevice - register a network device * @dev: device to register @@ -3633,8 +3687,10 @@ int register_netdevice(struct net_device *dev) /* Notify protocols, that a new device appeared. */ ret = call_netdevice_notifiers(NETDEV_REGISTER, dev); ret = notifier_to_errno(ret); - if (ret) - unregister_netdevice(dev); + if (ret) { + rollback_registered(dev); + dev->reg_state = NETREG_UNREGISTERED; + } out: return ret; @@ -3911,59 +3967,9 @@ void synchronize_net(void) void unregister_netdevice(struct net_device *dev) { - BUG_ON(dev_boot_phase); - ASSERT_RTNL(); - - /* Some devices call without registering for initialization unwind. */ - if (dev->reg_state == NETREG_UNINITIALIZED) { - printk(KERN_DEBUG "unregister_netdevice: device %s/%p never " - "was registered\n", dev->name, dev); - - WARN_ON(1); - return; - } - - BUG_ON(dev->reg_state != NETREG_REGISTERED); - - /* If device is running, close it first. */ - dev_close(dev); - - /* And unlink it from device chain. */ - unlist_netdevice(dev); - - dev->reg_state = NETREG_UNREGISTERING; - - synchronize_net(); - - /* Shutdown queueing discipline. */ - dev_shutdown(dev); - - - /* Notify protocols, that we are about to destroy - this device. They should clean all the things. - */ - call_netdevice_notifiers(NETDEV_UNREGISTER, dev); - - /* - * Flush the unicast and multicast chains - */ - dev_addr_discard(dev); - - if (dev->uninit) - dev->uninit(dev); - - /* Notifier chain MUST detach us from master device. */ - BUG_TRAP(!dev->master); - - /* Remove entries from kobject tree */ - netdev_unregister_kobject(dev); - + rollback_registered(dev); /* Finish processing unregister after unlock */ net_set_todo(dev); - - synchronize_net(); - - dev_put(dev); } /** diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 6f71db8c442..662e6ea1cec 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -112,6 +112,8 @@ out_undo: if (ops->exit) ops->exit(net); } + + rcu_barrier(); goto out; } diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 573e1724019..64b50ff7a41 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2028,8 +2028,8 @@ void __init skb_init(void) * Fill the specified scatter-gather list with mappings/pointers into a * region of the buffer space attached to a socket buffer. */ -int -skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) +static int +__skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) { int start = skb_headlen(skb); int i, copy = start - offset; @@ -2078,7 +2078,8 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) if ((copy = end - offset) > 0) { if (copy > len) copy = len; - elt += skb_to_sgvec(list, sg+elt, offset - start, copy); + elt += __skb_to_sgvec(list, sg+elt, offset - start, + copy); if ((len -= copy) == 0) return elt; offset += copy; @@ -2090,6 +2091,15 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) return elt; } +int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) +{ + int nsg = __skb_to_sgvec(skb, sg, offset, len); + + __sg_mark_end(&sg[nsg - 1]); + + return nsg; +} + /** * skb_cow_data - Check that a socket buffer's data buffers are writable * @skb: The socket buffer to check. diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index cad4278025a..c31bccb9b52 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -111,9 +111,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) goto unlock; } sg_init_table(sg, nfrags); - sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data + - esp->conf.ivlen - - skb->data, clen)); + skb_to_sgvec(skb, sg, + esph->enc_data + + esp->conf.ivlen - + skb->data, clen); err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); if (unlikely(sg != &esp->sgbuf[0])) kfree(sg); @@ -205,8 +206,9 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) goto out; } sg_init_table(sg, nfrags); - sg_mark_end(sg, skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, - elen)); + skb_to_sgvec(skb, sg, + sizeof(*esph) + esp->conf.ivlen, + elen); err = crypto_blkcipher_decrypt(&desc, sg, sg, elen); if (unlikely(sg != &esp->sgbuf[0])) kfree(sg); diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index 6a1fec416ea..427b593c106 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c @@ -48,8 +48,6 @@ /* for sysctl */ #include <linux/fs.h> #include <linux/sysctl.h> -/* for proc_net_create/proc_net_remove */ -#include <linux/proc_fs.h> #include <net/net_namespace.h> #include <net/ip_vs.h> @@ -547,71 +545,6 @@ static void ip_vs_lblcr_check_expire(unsigned long data) mod_timer(&tbl->periodic_timer, jiffies+CHECK_EXPIRE_INTERVAL); } - -#ifdef CONFIG_IP_VS_LBLCR_DEBUG -static struct ip_vs_lblcr_table *lblcr_table_list; - -/* - * /proc/net/ip_vs_lblcr to display the mappings of - * destination IP address <==> its serverSet - */ -static int -ip_vs_lblcr_getinfo(char *buffer, char **start, off_t offset, int length) -{ - off_t pos=0, begin; - int len=0, size; - struct ip_vs_lblcr_table *tbl; - unsigned long now = jiffies; - int i; - struct ip_vs_lblcr_entry *en; - - tbl = lblcr_table_list; - - size = sprintf(buffer, "LastTime Dest IP address Server set\n"); - pos += size; - len += size; - - for (i=0; i<IP_VS_LBLCR_TAB_SIZE; i++) { - read_lock_bh(&tbl->lock); - list_for_each_entry(en, &tbl->bucket[i], list) { - char tbuf[16]; - struct ip_vs_dest_list *d; - - sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(en->addr)); - size = sprintf(buffer+len, "%8lu %-16s ", - now-en->lastuse, tbuf); - - read_lock(&en->set.lock); - for (d=en->set.list; d!=NULL; d=d->next) { - size += sprintf(buffer+len+size, - "%u.%u.%u.%u ", - NIPQUAD(d->dest->addr)); - } - read_unlock(&en->set.lock); - size += sprintf(buffer+len+size, "\n"); - len += size; - pos += size; - if (pos <= offset) - len=0; - if (pos >= offset+length) { - read_unlock_bh(&tbl->lock); - goto done; - } - } - read_unlock_bh(&tbl->lock); - } - - done: - begin = len - (pos - offset); - *start = buffer + begin; - len -= begin; - if(len>length) - len = length; - return len; -} -#endif - - static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc) { int i; @@ -650,9 +583,6 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc) tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL; add_timer(&tbl->periodic_timer); -#ifdef CONFIG_IP_VS_LBLCR_DEBUG - lblcr_table_list = tbl; -#endif return 0; } @@ -843,18 +773,12 @@ static int __init ip_vs_lblcr_init(void) { INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); sysctl_header = register_sysctl_table(lblcr_root_table); -#ifdef CONFIG_IP_VS_LBLCR_DEBUG - proc_net_create(&init_net, "ip_vs_lblcr", 0, ip_vs_lblcr_getinfo); -#endif return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); } static void __exit ip_vs_lblcr_cleanup(void) { -#ifdef CONFIG_IP_VS_LBLCR_DEBUG - proc_net_remove(&init_net, "ip_vs_lblcr"); -#endif unregister_sysctl_table(sysctl_header); unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler); } diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index d3d8d5dfcee..eec02b29ffc 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1083,7 +1083,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, sg_set_buf(&sg[block++], key->key, key->keylen); nbytes += key->keylen; - sg_mark_end(sg, block); + __sg_mark_end(&sg[block - 1]); /* Now store the Hash into the packet */ err = crypto_hash_init(desc); diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 348bd8d0611..1bd8d818f8e 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -4288,8 +4288,4 @@ void __exit addrconf_cleanup(void) del_timer(&addr_chk_timer); rtnl_unlock(); - -#ifdef CONFIG_PROC_FS - proc_net_remove(&init_net, "if_inet6"); -#endif } diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index ab17b5e6235..7db66f10e00 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -110,9 +110,10 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) goto unlock; } sg_init_table(sg, nfrags); - sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data + - esp->conf.ivlen - - skb->data, clen)); + skb_to_sgvec(skb, sg, + esph->enc_data + + esp->conf.ivlen - + skb->data, clen); err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); if (unlikely(sg != &esp->sgbuf[0])) kfree(sg); @@ -209,9 +210,9 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) } } sg_init_table(sg, nfrags); - sg_mark_end(sg, skb_to_sgvec(skb, sg, - sizeof(*esph) + esp->conf.ivlen, - elen)); + skb_to_sgvec(skb, sg, + sizeof(*esph) + esp->conf.ivlen, + elen); ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen); if (unlikely(sg != &esp->sgbuf[0])) kfree(sg); diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index f1523b82cac..4b903288095 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -781,7 +781,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, sg_set_buf(&sg[block++], key->key, key->keylen); nbytes += key->keylen; - sg_mark_end(sg, block); + __sg_mark_end(&sg[block - 1]); /* Now store the hash into the packet */ err = crypto_hash_init(desc); diff --git a/net/key/af_key.c b/net/key/af_key.c index 7969f8a716d..266f112c38c 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -395,9 +395,9 @@ static inline int pfkey_sec_ctx_len(struct sadb_x_sec_ctx *sec_ctx) static inline int verify_sec_ctx_len(void *p) { struct sadb_x_sec_ctx *sec_ctx = (struct sadb_x_sec_ctx *)p; - int len; + int len = sec_ctx->sadb_x_ctx_len; - if (sec_ctx->sadb_x_ctx_len > PAGE_SIZE) + if (len > PAGE_SIZE) return -EINVAL; len = pfkey_sec_ctx_len(sec_ctx); diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index eebefb6ef13..c387cf68a08 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c @@ -237,7 +237,8 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call, len = data_size + call->conn->size_align - 1; len &= ~(call->conn->size_align - 1); - sg_init_table(sg, skb_to_sgvec(skb, sg, 0, len)); + sg_init_table(sg, nsg); + skb_to_sgvec(skb, sg, 0, len); crypto_blkcipher_encrypt_iv(&desc, sg, sg, len); _leave(" = 0"); @@ -344,7 +345,7 @@ static int rxkad_verify_packet_auth(const struct rxrpc_call *call, goto nomem; sg_init_table(sg, nsg); - sg_mark_end(sg, skb_to_sgvec(skb, sg, 0, 8)); + skb_to_sgvec(skb, sg, 0, 8); /* start the decryption afresh */ memset(&iv, 0, sizeof(iv)); @@ -426,7 +427,7 @@ static int rxkad_verify_packet_encrypt(const struct rxrpc_call *call, } sg_init_table(sg, nsg); - sg_mark_end(sg, skb_to_sgvec(skb, sg, 0, skb->len)); + skb_to_sgvec(skb, sg, 0, skb->len); /* decrypt from the session key */ payload = call->conn->key->payload.data; @@ -701,7 +702,7 @@ static void rxkad_sg_set_buf2(struct scatterlist sg[2], nsg++; } - sg_mark_end(sg, nsg); + __sg_mark_end(&sg[nsg - 1]); ASSERTCMP(sg[0].length + sg[1].length, ==, buflen); } diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index 91cd8f0d1e1..ab7cbd6575c 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -211,8 +211,8 @@ encryptor(struct scatterlist *sg, void *data) if (thislen == 0) return 0; - sg_mark_end(desc->infrags, desc->fragno); - sg_mark_end(desc->outfrags, desc->fragno); + __sg_mark_end(&desc->infrags[desc->fragno - 1]); + __sg_mark_end(&desc->outfrags[desc->fragno - 1]); ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags, desc->infrags, thislen); @@ -293,7 +293,7 @@ decryptor(struct scatterlist *sg, void *data) if (thislen == 0) return 0; - sg_mark_end(desc->frags, desc->fragno); + __sg_mark_end(&desc->frags[desc->fragno - 1]); ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags, desc->frags, thislen); |