diff options
author | David S. Miller <davem@davemloft.net> | 2008-11-27 02:48:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-27 02:48:40 -0500 |
commit | 5b9ab2ec04ec1e1e53939768805612ac191d7ba2 (patch) | |
tree | 22d29905c148d2d743b3eccb585fbe60fb91e25a /net/core/sock.c | |
parent | 851fd7bd88524bb4e20f3def3127cd9167d6d0cf (diff) | |
parent | 3ec192559033ed457f0d7856838654c100fc659f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/hp-plus.c
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/ath9k/recv.c
net/wireless/reg.c
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index b28764558a7d..ac4f0e79226b 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2043,9 +2043,6 @@ static inline void release_proto_idx(struct proto *prot) | |||
2043 | 2043 | ||
2044 | int proto_register(struct proto *prot, int alloc_slab) | 2044 | int proto_register(struct proto *prot, int alloc_slab) |
2045 | { | 2045 | { |
2046 | char *request_sock_slab_name = NULL; | ||
2047 | char *timewait_sock_slab_name; | ||
2048 | |||
2049 | if (alloc_slab) { | 2046 | if (alloc_slab) { |
2050 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, | 2047 | prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, |
2051 | SLAB_HWCACHE_ALIGN | prot->slab_flags, | 2048 | SLAB_HWCACHE_ALIGN | prot->slab_flags, |
@@ -2060,12 +2057,12 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
2060 | if (prot->rsk_prot != NULL) { | 2057 | if (prot->rsk_prot != NULL) { |
2061 | static const char mask[] = "request_sock_%s"; | 2058 | static const char mask[] = "request_sock_%s"; |
2062 | 2059 | ||
2063 | request_sock_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); | 2060 | prot->rsk_prot->slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); |
2064 | if (request_sock_slab_name == NULL) | 2061 | if (prot->rsk_prot->slab_name == NULL) |
2065 | goto out_free_sock_slab; | 2062 | goto out_free_sock_slab; |
2066 | 2063 | ||
2067 | sprintf(request_sock_slab_name, mask, prot->name); | 2064 | sprintf(prot->rsk_prot->slab_name, mask, prot->name); |
2068 | prot->rsk_prot->slab = kmem_cache_create(request_sock_slab_name, | 2065 | prot->rsk_prot->slab = kmem_cache_create(prot->rsk_prot->slab_name, |
2069 | prot->rsk_prot->obj_size, 0, | 2066 | prot->rsk_prot->obj_size, 0, |
2070 | SLAB_HWCACHE_ALIGN, NULL); | 2067 | SLAB_HWCACHE_ALIGN, NULL); |
2071 | 2068 | ||
@@ -2079,14 +2076,14 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
2079 | if (prot->twsk_prot != NULL) { | 2076 | if (prot->twsk_prot != NULL) { |
2080 | static const char mask[] = "tw_sock_%s"; | 2077 | static const char mask[] = "tw_sock_%s"; |
2081 | 2078 | ||
2082 | timewait_sock_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); | 2079 | prot->twsk_prot->twsk_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); |
2083 | 2080 | ||
2084 | if (timewait_sock_slab_name == NULL) | 2081 | if (prot->twsk_prot->twsk_slab_name == NULL) |
2085 | goto out_free_request_sock_slab; | 2082 | goto out_free_request_sock_slab; |
2086 | 2083 | ||
2087 | sprintf(timewait_sock_slab_name, mask, prot->name); | 2084 | sprintf(prot->twsk_prot->twsk_slab_name, mask, prot->name); |
2088 | prot->twsk_prot->twsk_slab = | 2085 | prot->twsk_prot->twsk_slab = |
2089 | kmem_cache_create(timewait_sock_slab_name, | 2086 | kmem_cache_create(prot->twsk_prot->twsk_slab_name, |
2090 | prot->twsk_prot->twsk_obj_size, | 2087 | prot->twsk_prot->twsk_obj_size, |
2091 | 0, | 2088 | 0, |
2092 | SLAB_HWCACHE_ALIGN | | 2089 | SLAB_HWCACHE_ALIGN | |
@@ -2104,14 +2101,14 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
2104 | return 0; | 2101 | return 0; |
2105 | 2102 | ||
2106 | out_free_timewait_sock_slab_name: | 2103 | out_free_timewait_sock_slab_name: |
2107 | kfree(timewait_sock_slab_name); | 2104 | kfree(prot->twsk_prot->twsk_slab_name); |
2108 | out_free_request_sock_slab: | 2105 | out_free_request_sock_slab: |
2109 | if (prot->rsk_prot && prot->rsk_prot->slab) { | 2106 | if (prot->rsk_prot && prot->rsk_prot->slab) { |
2110 | kmem_cache_destroy(prot->rsk_prot->slab); | 2107 | kmem_cache_destroy(prot->rsk_prot->slab); |
2111 | prot->rsk_prot->slab = NULL; | 2108 | prot->rsk_prot->slab = NULL; |
2112 | } | 2109 | } |
2113 | out_free_request_sock_slab_name: | 2110 | out_free_request_sock_slab_name: |
2114 | kfree(request_sock_slab_name); | 2111 | kfree(prot->rsk_prot->slab_name); |
2115 | out_free_sock_slab: | 2112 | out_free_sock_slab: |
2116 | kmem_cache_destroy(prot->slab); | 2113 | kmem_cache_destroy(prot->slab); |
2117 | prot->slab = NULL; | 2114 | prot->slab = NULL; |
@@ -2134,18 +2131,14 @@ void proto_unregister(struct proto *prot) | |||
2134 | } | 2131 | } |
2135 | 2132 | ||
2136 | if (prot->rsk_prot != NULL && prot->rsk_prot->slab != NULL) { | 2133 | if (prot->rsk_prot != NULL && prot->rsk_prot->slab != NULL) { |
2137 | const char *name = kmem_cache_name(prot->rsk_prot->slab); | ||
2138 | |||
2139 | kmem_cache_destroy(prot->rsk_prot->slab); | 2134 | kmem_cache_destroy(prot->rsk_prot->slab); |
2140 | kfree(name); | 2135 | kfree(prot->rsk_prot->slab_name); |
2141 | prot->rsk_prot->slab = NULL; | 2136 | prot->rsk_prot->slab = NULL; |
2142 | } | 2137 | } |
2143 | 2138 | ||
2144 | if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) { | 2139 | if (prot->twsk_prot != NULL && prot->twsk_prot->twsk_slab != NULL) { |
2145 | const char *name = kmem_cache_name(prot->twsk_prot->twsk_slab); | ||
2146 | |||
2147 | kmem_cache_destroy(prot->twsk_prot->twsk_slab); | 2140 | kmem_cache_destroy(prot->twsk_prot->twsk_slab); |
2148 | kfree(name); | 2141 | kfree(prot->twsk_prot->twsk_slab_name); |
2149 | prot->twsk_prot->twsk_slab = NULL; | 2142 | prot->twsk_prot->twsk_slab = NULL; |
2150 | } | 2143 | } |
2151 | } | 2144 | } |