diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/bridge/netfilter/nft_reject_bridge.c | 1 | ||||
| -rw-r--r-- | net/ceph/crypto.c | 169 | ||||
| -rw-r--r-- | net/ceph/osd_client.c | 7 | ||||
| -rw-r--r-- | net/dsa/slave.c | 7 | ||||
| -rw-r--r-- | net/ipv4/fou.c | 2 | ||||
| -rw-r--r-- | net/ipv4/geneve.c | 3 | ||||
| -rw-r--r-- | net/ipv4/ip_sockglue.c | 2 | ||||
| -rw-r--r-- | net/ipv4/tcp_input.c | 60 | ||||
| -rw-r--r-- | net/ipv6/ip6_gre.c | 5 | ||||
| -rw-r--r-- | net/ipv6/ip6_tunnel.c | 10 | ||||
| -rw-r--r-- | net/ipv6/ip6_vti.c | 11 | ||||
| -rw-r--r-- | net/ipv6/sit.c | 15 | ||||
| -rw-r--r-- | net/mac80211/ibss.c | 2 | ||||
| -rw-r--r-- | net/mac80211/ieee80211_i.h | 3 | ||||
| -rw-r--r-- | net/mac80211/iface.c | 18 | ||||
| -rw-r--r-- | net/mac80211/mesh.c | 2 | ||||
| -rw-r--r-- | net/mac80211/mlme.c | 5 | ||||
| -rw-r--r-- | net/mac80211/rx.c | 14 | ||||
| -rw-r--r-- | net/mac80211/spectmgmt.c | 18 | ||||
| -rw-r--r-- | net/netlink/af_netlink.c | 5 | ||||
| -rw-r--r-- | net/sctp/auth.c | 2 | ||||
| -rw-r--r-- | net/sctp/sm_make_chunk.c | 3 | ||||
| -rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 35 |
23 files changed, 258 insertions, 141 deletions
diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c index 654c9018e3e7..48da2c54a69e 100644 --- a/net/bridge/netfilter/nft_reject_bridge.c +++ b/net/bridge/netfilter/nft_reject_bridge.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <net/netfilter/ipv6/nf_reject.h> | 18 | #include <net/netfilter/ipv6/nf_reject.h> |
| 19 | #include <linux/ip.h> | 19 | #include <linux/ip.h> |
| 20 | #include <net/ip.h> | 20 | #include <net/ip.h> |
| 21 | #include <net/ip6_checksum.h> | ||
| 21 | #include <linux/netfilter_bridge.h> | 22 | #include <linux/netfilter_bridge.h> |
| 22 | #include "../br_private.h" | 23 | #include "../br_private.h" |
| 23 | 24 | ||
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index 62fc5e7a9acf..790fe89d90c0 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c | |||
| @@ -90,11 +90,82 @@ static struct crypto_blkcipher *ceph_crypto_alloc_cipher(void) | |||
| 90 | 90 | ||
| 91 | static const u8 *aes_iv = (u8 *)CEPH_AES_IV; | 91 | static const u8 *aes_iv = (u8 *)CEPH_AES_IV; |
| 92 | 92 | ||
| 93 | /* | ||
| 94 | * Should be used for buffers allocated with ceph_kvmalloc(). | ||
| 95 | * Currently these are encrypt out-buffer (ceph_buffer) and decrypt | ||
| 96 | * in-buffer (msg front). | ||
| 97 | * | ||
| 98 | * Dispose of @sgt with teardown_sgtable(). | ||
| 99 | * | ||
| 100 | * @prealloc_sg is to avoid memory allocation inside sg_alloc_table() | ||
| 101 | * in cases where a single sg is sufficient. No attempt to reduce the | ||
| 102 | * number of sgs by squeezing physically contiguous pages together is | ||
| 103 | * made though, for simplicity. | ||
| 104 | */ | ||
| 105 | static int setup_sgtable(struct sg_table *sgt, struct scatterlist *prealloc_sg, | ||
| 106 | const void *buf, unsigned int buf_len) | ||
| 107 | { | ||
| 108 | struct scatterlist *sg; | ||
| 109 | const bool is_vmalloc = is_vmalloc_addr(buf); | ||
| 110 | unsigned int off = offset_in_page(buf); | ||
| 111 | unsigned int chunk_cnt = 1; | ||
| 112 | unsigned int chunk_len = PAGE_ALIGN(off + buf_len); | ||
| 113 | int i; | ||
| 114 | int ret; | ||
| 115 | |||
| 116 | if (buf_len == 0) { | ||
| 117 | memset(sgt, 0, sizeof(*sgt)); | ||
| 118 | return -EINVAL; | ||
| 119 | } | ||
| 120 | |||
| 121 | if (is_vmalloc) { | ||
| 122 | chunk_cnt = chunk_len >> PAGE_SHIFT; | ||
| 123 | chunk_len = PAGE_SIZE; | ||
| 124 | } | ||
| 125 | |||
| 126 | if (chunk_cnt > 1) { | ||
| 127 | ret = sg_alloc_table(sgt, chunk_cnt, GFP_NOFS); | ||
| 128 | if (ret) | ||
| 129 | return ret; | ||
| 130 | } else { | ||
| 131 | WARN_ON(chunk_cnt != 1); | ||
| 132 | sg_init_table(prealloc_sg, 1); | ||
| 133 | sgt->sgl = prealloc_sg; | ||
| 134 | sgt->nents = sgt->orig_nents = 1; | ||
| 135 | } | ||
| 136 | |||
| 137 | for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) { | ||
| 138 | struct page *page; | ||
| 139 | unsigned int len = min(chunk_len - off, buf_len); | ||
| 140 | |||
| 141 | if (is_vmalloc) | ||
| 142 | page = vmalloc_to_page(buf); | ||
| 143 | else | ||
| 144 | page = virt_to_page(buf); | ||
| 145 | |||
| 146 | sg_set_page(sg, page, len, off); | ||
| 147 | |||
| 148 | off = 0; | ||
| 149 | buf += len; | ||
| 150 | buf_len -= len; | ||
| 151 | } | ||
| 152 | WARN_ON(buf_len != 0); | ||
| 153 | |||
| 154 | return 0; | ||
| 155 | } | ||
| 156 | |||
| 157 | static void teardown_sgtable(struct sg_table *sgt) | ||
| 158 | { | ||
| 159 | if (sgt->orig_nents > 1) | ||
| 160 | sg_free_table(sgt); | ||
| 161 | } | ||
| 162 | |||
| 93 | static int ceph_aes_encrypt(const void *key, int key_len, | 163 | static int ceph_aes_encrypt(const void *key, int key_len, |
| 94 | void *dst, size_t *dst_len, | 164 | void *dst, size_t *dst_len, |
| 95 | const void *src, size_t src_len) | 165 | const void *src, size_t src_len) |
| 96 | { | 166 | { |
| 97 | struct scatterlist sg_in[2], sg_out[1]; | 167 | struct scatterlist sg_in[2], prealloc_sg; |
| 168 | struct sg_table sg_out; | ||
| 98 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 169 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
| 99 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; | 170 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; |
| 100 | int ret; | 171 | int ret; |
| @@ -110,16 +181,18 @@ static int ceph_aes_encrypt(const void *key, int key_len, | |||
| 110 | 181 | ||
| 111 | *dst_len = src_len + zero_padding; | 182 | *dst_len = src_len + zero_padding; |
| 112 | 183 | ||
| 113 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
| 114 | sg_init_table(sg_in, 2); | 184 | sg_init_table(sg_in, 2); |
| 115 | sg_set_buf(&sg_in[0], src, src_len); | 185 | sg_set_buf(&sg_in[0], src, src_len); |
| 116 | sg_set_buf(&sg_in[1], pad, zero_padding); | 186 | sg_set_buf(&sg_in[1], pad, zero_padding); |
| 117 | sg_init_table(sg_out, 1); | 187 | ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); |
| 118 | sg_set_buf(sg_out, dst, *dst_len); | 188 | if (ret) |
| 189 | goto out_tfm; | ||
| 190 | |||
| 191 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
| 119 | iv = crypto_blkcipher_crt(tfm)->iv; | 192 | iv = crypto_blkcipher_crt(tfm)->iv; |
| 120 | ivsize = crypto_blkcipher_ivsize(tfm); | 193 | ivsize = crypto_blkcipher_ivsize(tfm); |
| 121 | |||
| 122 | memcpy(iv, aes_iv, ivsize); | 194 | memcpy(iv, aes_iv, ivsize); |
| 195 | |||
| 123 | /* | 196 | /* |
| 124 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, | 197 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, |
| 125 | key, key_len, 1); | 198 | key, key_len, 1); |
| @@ -128,16 +201,22 @@ static int ceph_aes_encrypt(const void *key, int key_len, | |||
| 128 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, | 201 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, |
| 129 | pad, zero_padding, 1); | 202 | pad, zero_padding, 1); |
| 130 | */ | 203 | */ |
| 131 | ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, | 204 | ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, |
| 132 | src_len + zero_padding); | 205 | src_len + zero_padding); |
| 133 | crypto_free_blkcipher(tfm); | 206 | if (ret < 0) { |
| 134 | if (ret < 0) | ||
| 135 | pr_err("ceph_aes_crypt failed %d\n", ret); | 207 | pr_err("ceph_aes_crypt failed %d\n", ret); |
| 208 | goto out_sg; | ||
| 209 | } | ||
| 136 | /* | 210 | /* |
| 137 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, | 211 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, |
| 138 | dst, *dst_len, 1); | 212 | dst, *dst_len, 1); |
| 139 | */ | 213 | */ |
| 140 | return 0; | 214 | |
| 215 | out_sg: | ||
| 216 | teardown_sgtable(&sg_out); | ||
| 217 | out_tfm: | ||
| 218 | crypto_free_blkcipher(tfm); | ||
| 219 | return ret; | ||
| 141 | } | 220 | } |
| 142 | 221 | ||
| 143 | static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | 222 | static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, |
| @@ -145,7 +224,8 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | |||
| 145 | const void *src1, size_t src1_len, | 224 | const void *src1, size_t src1_len, |
| 146 | const void *src2, size_t src2_len) | 225 | const void *src2, size_t src2_len) |
| 147 | { | 226 | { |
| 148 | struct scatterlist sg_in[3], sg_out[1]; | 227 | struct scatterlist sg_in[3], prealloc_sg; |
| 228 | struct sg_table sg_out; | ||
| 149 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 229 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
| 150 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; | 230 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; |
| 151 | int ret; | 231 | int ret; |
| @@ -161,17 +241,19 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | |||
| 161 | 241 | ||
| 162 | *dst_len = src1_len + src2_len + zero_padding; | 242 | *dst_len = src1_len + src2_len + zero_padding; |
| 163 | 243 | ||
| 164 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
| 165 | sg_init_table(sg_in, 3); | 244 | sg_init_table(sg_in, 3); |
| 166 | sg_set_buf(&sg_in[0], src1, src1_len); | 245 | sg_set_buf(&sg_in[0], src1, src1_len); |
| 167 | sg_set_buf(&sg_in[1], src2, src2_len); | 246 | sg_set_buf(&sg_in[1], src2, src2_len); |
| 168 | sg_set_buf(&sg_in[2], pad, zero_padding); | 247 | sg_set_buf(&sg_in[2], pad, zero_padding); |
| 169 | sg_init_table(sg_out, 1); | 248 | ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); |
| 170 | sg_set_buf(sg_out, dst, *dst_len); | 249 | if (ret) |
| 250 | goto out_tfm; | ||
| 251 | |||
| 252 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
| 171 | iv = crypto_blkcipher_crt(tfm)->iv; | 253 | iv = crypto_blkcipher_crt(tfm)->iv; |
| 172 | ivsize = crypto_blkcipher_ivsize(tfm); | 254 | ivsize = crypto_blkcipher_ivsize(tfm); |
| 173 | |||
| 174 | memcpy(iv, aes_iv, ivsize); | 255 | memcpy(iv, aes_iv, ivsize); |
| 256 | |||
| 175 | /* | 257 | /* |
| 176 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, | 258 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, |
| 177 | key, key_len, 1); | 259 | key, key_len, 1); |
| @@ -182,23 +264,30 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | |||
| 182 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, | 264 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, |
| 183 | pad, zero_padding, 1); | 265 | pad, zero_padding, 1); |
| 184 | */ | 266 | */ |
| 185 | ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, | 267 | ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, |
| 186 | src1_len + src2_len + zero_padding); | 268 | src1_len + src2_len + zero_padding); |
| 187 | crypto_free_blkcipher(tfm); | 269 | if (ret < 0) { |
| 188 | if (ret < 0) | ||
| 189 | pr_err("ceph_aes_crypt2 failed %d\n", ret); | 270 | pr_err("ceph_aes_crypt2 failed %d\n", ret); |
| 271 | goto out_sg; | ||
| 272 | } | ||
| 190 | /* | 273 | /* |
| 191 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, | 274 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, |
| 192 | dst, *dst_len, 1); | 275 | dst, *dst_len, 1); |
| 193 | */ | 276 | */ |
| 194 | return 0; | 277 | |
| 278 | out_sg: | ||
| 279 | teardown_sgtable(&sg_out); | ||
| 280 | out_tfm: | ||
| 281 | crypto_free_blkcipher(tfm); | ||
| 282 | return ret; | ||
| 195 | } | 283 | } |
| 196 | 284 | ||
| 197 | static int ceph_aes_decrypt(const void *key, int key_len, | 285 | static int ceph_aes_decrypt(const void *key, int key_len, |
| 198 | void *dst, size_t *dst_len, | 286 | void *dst, size_t *dst_len, |
| 199 | const void *src, size_t src_len) | 287 | const void *src, size_t src_len) |
| 200 | { | 288 | { |
| 201 | struct scatterlist sg_in[1], sg_out[2]; | 289 | struct sg_table sg_in; |
| 290 | struct scatterlist sg_out[2], prealloc_sg; | ||
| 202 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 291 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
| 203 | struct blkcipher_desc desc = { .tfm = tfm }; | 292 | struct blkcipher_desc desc = { .tfm = tfm }; |
| 204 | char pad[16]; | 293 | char pad[16]; |
| @@ -210,16 +299,16 @@ static int ceph_aes_decrypt(const void *key, int key_len, | |||
| 210 | if (IS_ERR(tfm)) | 299 | if (IS_ERR(tfm)) |
| 211 | return PTR_ERR(tfm); | 300 | return PTR_ERR(tfm); |
| 212 | 301 | ||
| 213 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
| 214 | sg_init_table(sg_in, 1); | ||
| 215 | sg_init_table(sg_out, 2); | 302 | sg_init_table(sg_out, 2); |
| 216 | sg_set_buf(sg_in, src, src_len); | ||
| 217 | sg_set_buf(&sg_out[0], dst, *dst_len); | 303 | sg_set_buf(&sg_out[0], dst, *dst_len); |
| 218 | sg_set_buf(&sg_out[1], pad, sizeof(pad)); | 304 | sg_set_buf(&sg_out[1], pad, sizeof(pad)); |
| 305 | ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); | ||
| 306 | if (ret) | ||
| 307 | goto out_tfm; | ||
| 219 | 308 | ||
| 309 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
| 220 | iv = crypto_blkcipher_crt(tfm)->iv; | 310 | iv = crypto_blkcipher_crt(tfm)->iv; |
| 221 | ivsize = crypto_blkcipher_ivsize(tfm); | 311 | ivsize = crypto_blkcipher_ivsize(tfm); |
| 222 | |||
| 223 | memcpy(iv, aes_iv, ivsize); | 312 | memcpy(iv, aes_iv, ivsize); |
| 224 | 313 | ||
| 225 | /* | 314 | /* |
| @@ -228,12 +317,10 @@ static int ceph_aes_decrypt(const void *key, int key_len, | |||
| 228 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, | 317 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, |
| 229 | src, src_len, 1); | 318 | src, src_len, 1); |
| 230 | */ | 319 | */ |
| 231 | 320 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); | |
| 232 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); | ||
| 233 | crypto_free_blkcipher(tfm); | ||
| 234 | if (ret < 0) { | 321 | if (ret < 0) { |
| 235 | pr_err("ceph_aes_decrypt failed %d\n", ret); | 322 | pr_err("ceph_aes_decrypt failed %d\n", ret); |
| 236 | return ret; | 323 | goto out_sg; |
| 237 | } | 324 | } |
| 238 | 325 | ||
| 239 | if (src_len <= *dst_len) | 326 | if (src_len <= *dst_len) |
| @@ -251,7 +338,12 @@ static int ceph_aes_decrypt(const void *key, int key_len, | |||
| 251 | print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1, | 338 | print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1, |
| 252 | dst, *dst_len, 1); | 339 | dst, *dst_len, 1); |
| 253 | */ | 340 | */ |
| 254 | return 0; | 341 | |
| 342 | out_sg: | ||
| 343 | teardown_sgtable(&sg_in); | ||
| 344 | out_tfm: | ||
| 345 | crypto_free_blkcipher(tfm); | ||
| 346 | return ret; | ||
| 255 | } | 347 | } |
| 256 | 348 | ||
| 257 | static int ceph_aes_decrypt2(const void *key, int key_len, | 349 | static int ceph_aes_decrypt2(const void *key, int key_len, |
| @@ -259,7 +351,8 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
| 259 | void *dst2, size_t *dst2_len, | 351 | void *dst2, size_t *dst2_len, |
| 260 | const void *src, size_t src_len) | 352 | const void *src, size_t src_len) |
| 261 | { | 353 | { |
| 262 | struct scatterlist sg_in[1], sg_out[3]; | 354 | struct sg_table sg_in; |
| 355 | struct scatterlist sg_out[3], prealloc_sg; | ||
| 263 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 356 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
| 264 | struct blkcipher_desc desc = { .tfm = tfm }; | 357 | struct blkcipher_desc desc = { .tfm = tfm }; |
| 265 | char pad[16]; | 358 | char pad[16]; |
| @@ -271,17 +364,17 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
| 271 | if (IS_ERR(tfm)) | 364 | if (IS_ERR(tfm)) |
| 272 | return PTR_ERR(tfm); | 365 | return PTR_ERR(tfm); |
| 273 | 366 | ||
| 274 | sg_init_table(sg_in, 1); | ||
| 275 | sg_set_buf(sg_in, src, src_len); | ||
| 276 | sg_init_table(sg_out, 3); | 367 | sg_init_table(sg_out, 3); |
| 277 | sg_set_buf(&sg_out[0], dst1, *dst1_len); | 368 | sg_set_buf(&sg_out[0], dst1, *dst1_len); |
| 278 | sg_set_buf(&sg_out[1], dst2, *dst2_len); | 369 | sg_set_buf(&sg_out[1], dst2, *dst2_len); |
| 279 | sg_set_buf(&sg_out[2], pad, sizeof(pad)); | 370 | sg_set_buf(&sg_out[2], pad, sizeof(pad)); |
| 371 | ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); | ||
| 372 | if (ret) | ||
| 373 | goto out_tfm; | ||
| 280 | 374 | ||
| 281 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | 375 | crypto_blkcipher_setkey((void *)tfm, key, key_len); |
| 282 | iv = crypto_blkcipher_crt(tfm)->iv; | 376 | iv = crypto_blkcipher_crt(tfm)->iv; |
| 283 | ivsize = crypto_blkcipher_ivsize(tfm); | 377 | ivsize = crypto_blkcipher_ivsize(tfm); |
| 284 | |||
| 285 | memcpy(iv, aes_iv, ivsize); | 378 | memcpy(iv, aes_iv, ivsize); |
| 286 | 379 | ||
| 287 | /* | 380 | /* |
| @@ -290,12 +383,10 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
| 290 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, | 383 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, |
| 291 | src, src_len, 1); | 384 | src, src_len, 1); |
| 292 | */ | 385 | */ |
| 293 | 386 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); | |
| 294 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); | ||
| 295 | crypto_free_blkcipher(tfm); | ||
| 296 | if (ret < 0) { | 387 | if (ret < 0) { |
| 297 | pr_err("ceph_aes_decrypt failed %d\n", ret); | 388 | pr_err("ceph_aes_decrypt failed %d\n", ret); |
| 298 | return ret; | 389 | goto out_sg; |
| 299 | } | 390 | } |
| 300 | 391 | ||
| 301 | if (src_len <= *dst1_len) | 392 | if (src_len <= *dst1_len) |
| @@ -325,7 +416,11 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
| 325 | dst2, *dst2_len, 1); | 416 | dst2, *dst2_len, 1); |
| 326 | */ | 417 | */ |
| 327 | 418 | ||
| 328 | return 0; | 419 | out_sg: |
| 420 | teardown_sgtable(&sg_in); | ||
| 421 | out_tfm: | ||
| 422 | crypto_free_blkcipher(tfm); | ||
| 423 | return ret; | ||
| 329 | } | 424 | } |
| 330 | 425 | ||
| 331 | 426 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index f3fc54eac09d..6f164289bde8 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
| @@ -1007,8 +1007,8 @@ static void put_osd(struct ceph_osd *osd) | |||
| 1007 | static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) | 1007 | static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) |
| 1008 | { | 1008 | { |
| 1009 | dout("__remove_osd %p\n", osd); | 1009 | dout("__remove_osd %p\n", osd); |
| 1010 | BUG_ON(!list_empty(&osd->o_requests)); | 1010 | WARN_ON(!list_empty(&osd->o_requests)); |
| 1011 | BUG_ON(!list_empty(&osd->o_linger_requests)); | 1011 | WARN_ON(!list_empty(&osd->o_linger_requests)); |
| 1012 | 1012 | ||
| 1013 | rb_erase(&osd->o_node, &osdc->osds); | 1013 | rb_erase(&osd->o_node, &osdc->osds); |
| 1014 | list_del_init(&osd->o_osd_lru); | 1014 | list_del_init(&osd->o_osd_lru); |
| @@ -1254,6 +1254,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc, | |||
| 1254 | if (list_empty(&req->r_osd_item)) | 1254 | if (list_empty(&req->r_osd_item)) |
| 1255 | req->r_osd = NULL; | 1255 | req->r_osd = NULL; |
| 1256 | } | 1256 | } |
| 1257 | |||
| 1258 | list_del_init(&req->r_req_lru_item); /* can be on notarget */ | ||
| 1257 | ceph_osdc_put_request(req); | 1259 | ceph_osdc_put_request(req); |
| 1258 | } | 1260 | } |
| 1259 | 1261 | ||
| @@ -1395,6 +1397,7 @@ static int __map_request(struct ceph_osd_client *osdc, | |||
| 1395 | if (req->r_osd) { | 1397 | if (req->r_osd) { |
| 1396 | __cancel_request(req); | 1398 | __cancel_request(req); |
| 1397 | list_del_init(&req->r_osd_item); | 1399 | list_del_init(&req->r_osd_item); |
| 1400 | list_del_init(&req->r_linger_osd_item); | ||
| 1398 | req->r_osd = NULL; | 1401 | req->r_osd = NULL; |
| 1399 | } | 1402 | } |
| 1400 | 1403 | ||
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 6d1817449c36..ab03e00ffe8f 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
| @@ -489,11 +489,14 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
| 489 | /* We could not connect to a designated PHY, so use the switch internal | 489 | /* We could not connect to a designated PHY, so use the switch internal |
| 490 | * MDIO bus instead | 490 | * MDIO bus instead |
| 491 | */ | 491 | */ |
| 492 | if (!p->phy) | 492 | if (!p->phy) { |
| 493 | p->phy = ds->slave_mii_bus->phy_map[p->port]; | 493 | p->phy = ds->slave_mii_bus->phy_map[p->port]; |
| 494 | else | 494 | phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, |
| 495 | p->phy_interface); | ||
| 496 | } else { | ||
| 495 | pr_info("attached PHY at address %d [%s]\n", | 497 | pr_info("attached PHY at address %d [%s]\n", |
| 496 | p->phy->addr, p->phy->drv->name); | 498 | p->phy->addr, p->phy->drv->name); |
| 499 | } | ||
| 497 | } | 500 | } |
| 498 | 501 | ||
| 499 | int dsa_slave_suspend(struct net_device *slave_dev) | 502 | int dsa_slave_suspend(struct net_device *slave_dev) |
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index 32e78924e246..606c520ffd5a 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
| @@ -133,6 +133,8 @@ static int fou_gro_complete(struct sk_buff *skb, int nhoff) | |||
| 133 | int err = -ENOSYS; | 133 | int err = -ENOSYS; |
| 134 | const struct net_offload **offloads; | 134 | const struct net_offload **offloads; |
| 135 | 135 | ||
| 136 | udp_tunnel_gro_complete(skb, nhoff); | ||
| 137 | |||
| 136 | rcu_read_lock(); | 138 | rcu_read_lock(); |
| 137 | offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; | 139 | offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; |
| 138 | ops = rcu_dereference(offloads[proto]); | 140 | ops = rcu_dereference(offloads[proto]); |
diff --git a/net/ipv4/geneve.c b/net/ipv4/geneve.c index 065cd94c640c..dedb21e99914 100644 --- a/net/ipv4/geneve.c +++ b/net/ipv4/geneve.c | |||
| @@ -144,6 +144,8 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, | |||
| 144 | gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len); | 144 | gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len); |
| 145 | geneve_build_header(gnvh, tun_flags, vni, opt_len, opt); | 145 | geneve_build_header(gnvh, tun_flags, vni, opt_len, opt); |
| 146 | 146 | ||
| 147 | skb_set_inner_protocol(skb, htons(ETH_P_TEB)); | ||
| 148 | |||
| 147 | return udp_tunnel_xmit_skb(gs->sock, rt, skb, src, dst, | 149 | return udp_tunnel_xmit_skb(gs->sock, rt, skb, src, dst, |
| 148 | tos, ttl, df, src_port, dst_port, xnet); | 150 | tos, ttl, df, src_port, dst_port, xnet); |
| 149 | } | 151 | } |
| @@ -364,6 +366,7 @@ late_initcall(geneve_init_module); | |||
| 364 | static void __exit geneve_cleanup_module(void) | 366 | static void __exit geneve_cleanup_module(void) |
| 365 | { | 367 | { |
| 366 | destroy_workqueue(geneve_wq); | 368 | destroy_workqueue(geneve_wq); |
| 369 | unregister_pernet_subsys(&geneve_net_ops); | ||
| 367 | } | 370 | } |
| 368 | module_exit(geneve_cleanup_module); | 371 | module_exit(geneve_cleanup_module); |
| 369 | 372 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index c373a9ad4555..9daf2177dc00 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
| @@ -195,7 +195,7 @@ int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc, | |||
| 195 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { | 195 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { |
| 196 | if (!CMSG_OK(msg, cmsg)) | 196 | if (!CMSG_OK(msg, cmsg)) |
| 197 | return -EINVAL; | 197 | return -EINVAL; |
| 198 | #if defined(CONFIG_IPV6) | 198 | #if IS_ENABLED(CONFIG_IPV6) |
| 199 | if (allow_ipv6 && | 199 | if (allow_ipv6 && |
| 200 | cmsg->cmsg_level == SOL_IPV6 && | 200 | cmsg->cmsg_level == SOL_IPV6 && |
| 201 | cmsg->cmsg_type == IPV6_PKTINFO) { | 201 | cmsg->cmsg_type == IPV6_PKTINFO) { |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index a12b455928e5..88fa2d160685 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -2315,6 +2315,35 @@ static inline bool tcp_packet_delayed(const struct tcp_sock *tp) | |||
| 2315 | 2315 | ||
| 2316 | /* Undo procedures. */ | 2316 | /* Undo procedures. */ |
| 2317 | 2317 | ||
| 2318 | /* We can clear retrans_stamp when there are no retransmissions in the | ||
| 2319 | * window. It would seem that it is trivially available for us in | ||
| 2320 | * tp->retrans_out, however, that kind of assumptions doesn't consider | ||
| 2321 | * what will happen if errors occur when sending retransmission for the | ||
| 2322 | * second time. ...It could the that such segment has only | ||
| 2323 | * TCPCB_EVER_RETRANS set at the present time. It seems that checking | ||
| 2324 | * the head skb is enough except for some reneging corner cases that | ||
| 2325 | * are not worth the effort. | ||
| 2326 | * | ||
| 2327 | * Main reason for all this complexity is the fact that connection dying | ||
| 2328 | * time now depends on the validity of the retrans_stamp, in particular, | ||
| 2329 | * that successive retransmissions of a segment must not advance | ||
| 2330 | * retrans_stamp under any conditions. | ||
| 2331 | */ | ||
| 2332 | static bool tcp_any_retrans_done(const struct sock *sk) | ||
| 2333 | { | ||
| 2334 | const struct tcp_sock *tp = tcp_sk(sk); | ||
| 2335 | struct sk_buff *skb; | ||
| 2336 | |||
| 2337 | if (tp->retrans_out) | ||
| 2338 | return true; | ||
| 2339 | |||
| 2340 | skb = tcp_write_queue_head(sk); | ||
| 2341 | if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) | ||
| 2342 | return true; | ||
| 2343 | |||
| 2344 | return false; | ||
| 2345 | } | ||
| 2346 | |||
| 2318 | #if FASTRETRANS_DEBUG > 1 | 2347 | #if FASTRETRANS_DEBUG > 1 |
| 2319 | static void DBGUNDO(struct sock *sk, const char *msg) | 2348 | static void DBGUNDO(struct sock *sk, const char *msg) |
| 2320 | { | 2349 | { |
| @@ -2410,6 +2439,8 @@ static bool tcp_try_undo_recovery(struct sock *sk) | |||
| 2410 | * is ACKed. For Reno it is MUST to prevent false | 2439 | * is ACKed. For Reno it is MUST to prevent false |
| 2411 | * fast retransmits (RFC2582). SACK TCP is safe. */ | 2440 | * fast retransmits (RFC2582). SACK TCP is safe. */ |
| 2412 | tcp_moderate_cwnd(tp); | 2441 | tcp_moderate_cwnd(tp); |
| 2442 | if (!tcp_any_retrans_done(sk)) | ||
| 2443 | tp->retrans_stamp = 0; | ||
| 2413 | return true; | 2444 | return true; |
| 2414 | } | 2445 | } |
| 2415 | tcp_set_ca_state(sk, TCP_CA_Open); | 2446 | tcp_set_ca_state(sk, TCP_CA_Open); |
| @@ -2430,35 +2461,6 @@ static bool tcp_try_undo_dsack(struct sock *sk) | |||
| 2430 | return false; | 2461 | return false; |
| 2431 | } | 2462 | } |
| 2432 | 2463 | ||
| 2433 | /* We can clear retrans_stamp when there are no retransmissions in the | ||
| 2434 | * window. It would seem that it is trivially available for us in | ||
| 2435 | * tp->retrans_out, however, that kind of assumptions doesn't consider | ||
| 2436 | * what will happen if errors occur when sending retransmission for the | ||
| 2437 | * second time. ...It could the that such segment has only | ||
| 2438 | * TCPCB_EVER_RETRANS set at the present time. It seems that checking | ||
| 2439 | * the head skb is enough except for some reneging corner cases that | ||
| 2440 | * are not worth the effort. | ||
| 2441 | * | ||
| 2442 | * Main reason for all this complexity is the fact that connection dying | ||
| 2443 | * time now depends on the validity of the retrans_stamp, in particular, | ||
| 2444 | * that successive retransmissions of a segment must not advance | ||
| 2445 | * retrans_stamp under any conditions. | ||
| 2446 | */ | ||
| 2447 | static bool tcp_any_retrans_done(const struct sock *sk) | ||
| 2448 | { | ||
| 2449 | const struct tcp_sock *tp = tcp_sk(sk); | ||
| 2450 | struct sk_buff *skb; | ||
| 2451 | |||
| 2452 | if (tp->retrans_out) | ||
| 2453 | return true; | ||
| 2454 | |||
| 2455 | skb = tcp_write_queue_head(sk); | ||
| 2456 | if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) | ||
| 2457 | return true; | ||
| 2458 | |||
| 2459 | return false; | ||
| 2460 | } | ||
| 2461 | |||
| 2462 | /* Undo during loss recovery after partial ACK or using F-RTO. */ | 2464 | /* Undo during loss recovery after partial ACK or using F-RTO. */ |
| 2463 | static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo) | 2465 | static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo) |
| 2464 | { | 2466 | { |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 12c3c8ef3849..4564e1fca3eb 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
| @@ -961,8 +961,6 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu) | |||
| 961 | else | 961 | else |
| 962 | dev->flags &= ~IFF_POINTOPOINT; | 962 | dev->flags &= ~IFF_POINTOPOINT; |
| 963 | 963 | ||
| 964 | dev->iflink = p->link; | ||
| 965 | |||
| 966 | /* Precalculate GRE options length */ | 964 | /* Precalculate GRE options length */ |
| 967 | if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { | 965 | if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { |
| 968 | if (t->parms.o_flags&GRE_CSUM) | 966 | if (t->parms.o_flags&GRE_CSUM) |
| @@ -1272,6 +1270,7 @@ static int ip6gre_tunnel_init(struct net_device *dev) | |||
| 1272 | u64_stats_init(&ip6gre_tunnel_stats->syncp); | 1270 | u64_stats_init(&ip6gre_tunnel_stats->syncp); |
| 1273 | } | 1271 | } |
| 1274 | 1272 | ||
| 1273 | dev->iflink = tunnel->parms.link; | ||
| 1275 | 1274 | ||
| 1276 | return 0; | 1275 | return 0; |
| 1277 | } | 1276 | } |
| @@ -1481,6 +1480,8 @@ static int ip6gre_tap_init(struct net_device *dev) | |||
| 1481 | if (!dev->tstats) | 1480 | if (!dev->tstats) |
| 1482 | return -ENOMEM; | 1481 | return -ENOMEM; |
| 1483 | 1482 | ||
| 1483 | dev->iflink = tunnel->parms.link; | ||
| 1484 | |||
| 1484 | return 0; | 1485 | return 0; |
| 1485 | } | 1486 | } |
| 1486 | 1487 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 9409887fb664..9cb94cfa0ae7 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
| @@ -272,9 +272,6 @@ static int ip6_tnl_create2(struct net_device *dev) | |||
| 272 | int err; | 272 | int err; |
| 273 | 273 | ||
| 274 | t = netdev_priv(dev); | 274 | t = netdev_priv(dev); |
| 275 | err = ip6_tnl_dev_init(dev); | ||
| 276 | if (err < 0) | ||
| 277 | goto out; | ||
| 278 | 275 | ||
| 279 | err = register_netdevice(dev); | 276 | err = register_netdevice(dev); |
| 280 | if (err < 0) | 277 | if (err < 0) |
| @@ -1462,6 +1459,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1462 | 1459 | ||
| 1463 | 1460 | ||
| 1464 | static const struct net_device_ops ip6_tnl_netdev_ops = { | 1461 | static const struct net_device_ops ip6_tnl_netdev_ops = { |
| 1462 | .ndo_init = ip6_tnl_dev_init, | ||
| 1465 | .ndo_uninit = ip6_tnl_dev_uninit, | 1463 | .ndo_uninit = ip6_tnl_dev_uninit, |
| 1466 | .ndo_start_xmit = ip6_tnl_xmit, | 1464 | .ndo_start_xmit = ip6_tnl_xmit, |
| 1467 | .ndo_do_ioctl = ip6_tnl_ioctl, | 1465 | .ndo_do_ioctl = ip6_tnl_ioctl, |
| @@ -1546,16 +1544,10 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev) | |||
| 1546 | struct ip6_tnl *t = netdev_priv(dev); | 1544 | struct ip6_tnl *t = netdev_priv(dev); |
| 1547 | struct net *net = dev_net(dev); | 1545 | struct net *net = dev_net(dev); |
| 1548 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 1546 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
| 1549 | int err = ip6_tnl_dev_init_gen(dev); | ||
| 1550 | |||
| 1551 | if (err) | ||
| 1552 | return err; | ||
| 1553 | 1547 | ||
| 1554 | t->parms.proto = IPPROTO_IPV6; | 1548 | t->parms.proto = IPPROTO_IPV6; |
| 1555 | dev_hold(dev); | 1549 | dev_hold(dev); |
| 1556 | 1550 | ||
| 1557 | ip6_tnl_link_config(t); | ||
| 1558 | |||
| 1559 | rcu_assign_pointer(ip6n->tnls_wc[0], t); | 1551 | rcu_assign_pointer(ip6n->tnls_wc[0], t); |
| 1560 | return 0; | 1552 | return 0; |
| 1561 | } | 1553 | } |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index d440bb585524..31089d153fd3 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
| @@ -172,10 +172,6 @@ static int vti6_tnl_create2(struct net_device *dev) | |||
| 172 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); | 172 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); |
| 173 | int err; | 173 | int err; |
| 174 | 174 | ||
| 175 | err = vti6_dev_init(dev); | ||
| 176 | if (err < 0) | ||
| 177 | goto out; | ||
| 178 | |||
| 179 | err = register_netdevice(dev); | 175 | err = register_netdevice(dev); |
| 180 | if (err < 0) | 176 | if (err < 0) |
| 181 | goto out; | 177 | goto out; |
| @@ -783,6 +779,7 @@ static int vti6_change_mtu(struct net_device *dev, int new_mtu) | |||
| 783 | } | 779 | } |
| 784 | 780 | ||
| 785 | static const struct net_device_ops vti6_netdev_ops = { | 781 | static const struct net_device_ops vti6_netdev_ops = { |
| 782 | .ndo_init = vti6_dev_init, | ||
| 786 | .ndo_uninit = vti6_dev_uninit, | 783 | .ndo_uninit = vti6_dev_uninit, |
| 787 | .ndo_start_xmit = vti6_tnl_xmit, | 784 | .ndo_start_xmit = vti6_tnl_xmit, |
| 788 | .ndo_do_ioctl = vti6_ioctl, | 785 | .ndo_do_ioctl = vti6_ioctl, |
| @@ -852,16 +849,10 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev) | |||
| 852 | struct ip6_tnl *t = netdev_priv(dev); | 849 | struct ip6_tnl *t = netdev_priv(dev); |
| 853 | struct net *net = dev_net(dev); | 850 | struct net *net = dev_net(dev); |
| 854 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); | 851 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); |
| 855 | int err = vti6_dev_init_gen(dev); | ||
| 856 | |||
| 857 | if (err) | ||
| 858 | return err; | ||
| 859 | 852 | ||
| 860 | t->parms.proto = IPPROTO_IPV6; | 853 | t->parms.proto = IPPROTO_IPV6; |
| 861 | dev_hold(dev); | 854 | dev_hold(dev); |
| 862 | 855 | ||
| 863 | vti6_link_config(t); | ||
| 864 | |||
| 865 | rcu_assign_pointer(ip6n->tnls_wc[0], t); | 856 | rcu_assign_pointer(ip6n->tnls_wc[0], t); |
| 866 | return 0; | 857 | return 0; |
| 867 | } | 858 | } |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 58e5b4710127..a24557a1c1d8 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
| @@ -195,10 +195,8 @@ static int ipip6_tunnel_create(struct net_device *dev) | |||
| 195 | struct sit_net *sitn = net_generic(net, sit_net_id); | 195 | struct sit_net *sitn = net_generic(net, sit_net_id); |
| 196 | int err; | 196 | int err; |
| 197 | 197 | ||
| 198 | err = ipip6_tunnel_init(dev); | 198 | memcpy(dev->dev_addr, &t->parms.iph.saddr, 4); |
| 199 | if (err < 0) | 199 | memcpy(dev->broadcast, &t->parms.iph.daddr, 4); |
| 200 | goto out; | ||
| 201 | ipip6_tunnel_clone_6rd(dev, sitn); | ||
| 202 | 200 | ||
| 203 | if ((__force u16)t->parms.i_flags & SIT_ISATAP) | 201 | if ((__force u16)t->parms.i_flags & SIT_ISATAP) |
| 204 | dev->priv_flags |= IFF_ISATAP; | 202 | dev->priv_flags |= IFF_ISATAP; |
| @@ -207,7 +205,8 @@ static int ipip6_tunnel_create(struct net_device *dev) | |||
| 207 | if (err < 0) | 205 | if (err < 0) |
| 208 | goto out; | 206 | goto out; |
| 209 | 207 | ||
| 210 | strcpy(t->parms.name, dev->name); | 208 | ipip6_tunnel_clone_6rd(dev, sitn); |
| 209 | |||
| 211 | dev->rtnl_link_ops = &sit_link_ops; | 210 | dev->rtnl_link_ops = &sit_link_ops; |
| 212 | 211 | ||
| 213 | dev_hold(dev); | 212 | dev_hold(dev); |
| @@ -1330,6 +1329,7 @@ static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1330 | } | 1329 | } |
| 1331 | 1330 | ||
| 1332 | static const struct net_device_ops ipip6_netdev_ops = { | 1331 | static const struct net_device_ops ipip6_netdev_ops = { |
| 1332 | .ndo_init = ipip6_tunnel_init, | ||
| 1333 | .ndo_uninit = ipip6_tunnel_uninit, | 1333 | .ndo_uninit = ipip6_tunnel_uninit, |
| 1334 | .ndo_start_xmit = sit_tunnel_xmit, | 1334 | .ndo_start_xmit = sit_tunnel_xmit, |
| 1335 | .ndo_do_ioctl = ipip6_tunnel_ioctl, | 1335 | .ndo_do_ioctl = ipip6_tunnel_ioctl, |
| @@ -1378,9 +1378,7 @@ static int ipip6_tunnel_init(struct net_device *dev) | |||
| 1378 | 1378 | ||
| 1379 | tunnel->dev = dev; | 1379 | tunnel->dev = dev; |
| 1380 | tunnel->net = dev_net(dev); | 1380 | tunnel->net = dev_net(dev); |
| 1381 | 1381 | strcpy(tunnel->parms.name, dev->name); | |
| 1382 | memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); | ||
| 1383 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); | ||
| 1384 | 1382 | ||
| 1385 | ipip6_tunnel_bind_dev(dev); | 1383 | ipip6_tunnel_bind_dev(dev); |
| 1386 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); | 1384 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
| @@ -1405,7 +1403,6 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) | |||
| 1405 | 1403 | ||
| 1406 | tunnel->dev = dev; | 1404 | tunnel->dev = dev; |
| 1407 | tunnel->net = dev_net(dev); | 1405 | tunnel->net = dev_net(dev); |
| 1408 | strcpy(tunnel->parms.name, dev->name); | ||
| 1409 | 1406 | ||
| 1410 | iph->version = 4; | 1407 | iph->version = 4; |
| 1411 | iph->protocol = IPPROTO_IPV6; | 1408 | iph->protocol = IPPROTO_IPV6; |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 56b53571c807..509bc157ce55 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
| @@ -805,7 +805,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
| 805 | 805 | ||
| 806 | memset(¶ms, 0, sizeof(params)); | 806 | memset(¶ms, 0, sizeof(params)); |
| 807 | memset(&csa_ie, 0, sizeof(csa_ie)); | 807 | memset(&csa_ie, 0, sizeof(csa_ie)); |
| 808 | err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, | 808 | err = ieee80211_parse_ch_switch_ie(sdata, elems, |
| 809 | ifibss->chandef.chan->band, | 809 | ifibss->chandef.chan->band, |
| 810 | sta_flags, ifibss->bssid, &csa_ie); | 810 | sta_flags, ifibss->bssid, &csa_ie); |
| 811 | /* can't switch to destination channel, fail */ | 811 | /* can't switch to destination channel, fail */ |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c2aaec4dfcf0..8c68da30595d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -1642,7 +1642,6 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, | |||
| 1642 | * ieee80211_parse_ch_switch_ie - parses channel switch IEs | 1642 | * ieee80211_parse_ch_switch_ie - parses channel switch IEs |
| 1643 | * @sdata: the sdata of the interface which has received the frame | 1643 | * @sdata: the sdata of the interface which has received the frame |
| 1644 | * @elems: parsed 802.11 elements received with the frame | 1644 | * @elems: parsed 802.11 elements received with the frame |
| 1645 | * @beacon: indicates if the frame was a beacon or probe response | ||
| 1646 | * @current_band: indicates the current band | 1645 | * @current_band: indicates the current band |
| 1647 | * @sta_flags: contains information about own capabilities and restrictions | 1646 | * @sta_flags: contains information about own capabilities and restrictions |
| 1648 | * to decide which channel switch announcements can be accepted. Only the | 1647 | * to decide which channel switch announcements can be accepted. Only the |
| @@ -1656,7 +1655,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, | |||
| 1656 | * Return: 0 on success, <0 on error and >0 if there is nothing to parse. | 1655 | * Return: 0 on success, <0 on error and >0 if there is nothing to parse. |
| 1657 | */ | 1656 | */ |
| 1658 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | 1657 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, |
| 1659 | struct ieee802_11_elems *elems, bool beacon, | 1658 | struct ieee802_11_elems *elems, |
| 1660 | enum ieee80211_band current_band, | 1659 | enum ieee80211_band current_band, |
| 1661 | u32 sta_flags, u8 *bssid, | 1660 | u32 sta_flags, u8 *bssid, |
| 1662 | struct ieee80211_csa_ie *csa_ie); | 1661 | struct ieee80211_csa_ie *csa_ie); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index af237223a8cd..653f5eb07a27 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
| @@ -766,10 +766,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
| 766 | int i, flushed; | 766 | int i, flushed; |
| 767 | struct ps_data *ps; | 767 | struct ps_data *ps; |
| 768 | struct cfg80211_chan_def chandef; | 768 | struct cfg80211_chan_def chandef; |
| 769 | bool cancel_scan; | ||
| 769 | 770 | ||
| 770 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); | 771 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); |
| 771 | 772 | ||
| 772 | if (rcu_access_pointer(local->scan_sdata) == sdata) | 773 | cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata; |
| 774 | if (cancel_scan) | ||
| 773 | ieee80211_scan_cancel(local); | 775 | ieee80211_scan_cancel(local); |
| 774 | 776 | ||
| 775 | /* | 777 | /* |
| @@ -898,6 +900,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
| 898 | list_del(&sdata->u.vlan.list); | 900 | list_del(&sdata->u.vlan.list); |
| 899 | mutex_unlock(&local->mtx); | 901 | mutex_unlock(&local->mtx); |
| 900 | RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); | 902 | RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); |
| 903 | /* see comment in the default case below */ | ||
| 904 | ieee80211_free_keys(sdata, true); | ||
| 901 | /* no need to tell driver */ | 905 | /* no need to tell driver */ |
| 902 | break; | 906 | break; |
| 903 | case NL80211_IFTYPE_MONITOR: | 907 | case NL80211_IFTYPE_MONITOR: |
| @@ -923,17 +927,16 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
| 923 | /* | 927 | /* |
| 924 | * When we get here, the interface is marked down. | 928 | * When we get here, the interface is marked down. |
| 925 | * Free the remaining keys, if there are any | 929 | * Free the remaining keys, if there are any |
| 926 | * (shouldn't be, except maybe in WDS mode?) | 930 | * (which can happen in AP mode if userspace sets |
| 931 | * keys before the interface is operating, and maybe | ||
| 932 | * also in WDS mode) | ||
| 927 | * | 933 | * |
| 928 | * Force the key freeing to always synchronize_net() | 934 | * Force the key freeing to always synchronize_net() |
| 929 | * to wait for the RX path in case it is using this | 935 | * to wait for the RX path in case it is using this |
| 930 | * interface enqueuing frames * at this very time on | 936 | * interface enqueuing frames at this very time on |
| 931 | * another CPU. | 937 | * another CPU. |
| 932 | */ | 938 | */ |
| 933 | ieee80211_free_keys(sdata, true); | 939 | ieee80211_free_keys(sdata, true); |
| 934 | |||
| 935 | /* fall through */ | ||
| 936 | case NL80211_IFTYPE_AP: | ||
| 937 | skb_queue_purge(&sdata->skb_queue); | 940 | skb_queue_purge(&sdata->skb_queue); |
| 938 | } | 941 | } |
| 939 | 942 | ||
| @@ -991,6 +994,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
| 991 | 994 | ||
| 992 | ieee80211_recalc_ps(local, -1); | 995 | ieee80211_recalc_ps(local, -1); |
| 993 | 996 | ||
| 997 | if (cancel_scan) | ||
| 998 | flush_delayed_work(&local->scan_work); | ||
| 999 | |||
| 994 | if (local->open_count == 0) { | 1000 | if (local->open_count == 0) { |
| 995 | ieee80211_stop_device(local); | 1001 | ieee80211_stop_device(local); |
| 996 | 1002 | ||
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index e9f99c1e3fad..0c8b2a77d312 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
| @@ -874,7 +874,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, | |||
| 874 | 874 | ||
| 875 | memset(¶ms, 0, sizeof(params)); | 875 | memset(¶ms, 0, sizeof(params)); |
| 876 | memset(&csa_ie, 0, sizeof(csa_ie)); | 876 | memset(&csa_ie, 0, sizeof(csa_ie)); |
| 877 | err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band, | 877 | err = ieee80211_parse_ch_switch_ie(sdata, elems, band, |
| 878 | sta_flags, sdata->vif.addr, | 878 | sta_flags, sdata->vif.addr, |
| 879 | &csa_ie); | 879 | &csa_ie); |
| 880 | if (err < 0) | 880 | if (err < 0) |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 2de88704278b..93af0f1c9d99 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -1072,7 +1072,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
| 1072 | 1072 | ||
| 1073 | current_band = cbss->channel->band; | 1073 | current_band = cbss->channel->band; |
| 1074 | memset(&csa_ie, 0, sizeof(csa_ie)); | 1074 | memset(&csa_ie, 0, sizeof(csa_ie)); |
| 1075 | res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band, | 1075 | res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band, |
| 1076 | ifmgd->flags, | 1076 | ifmgd->flags, |
| 1077 | ifmgd->associated->bssid, &csa_ie); | 1077 | ifmgd->associated->bssid, &csa_ie); |
| 1078 | if (res < 0) | 1078 | if (res < 0) |
| @@ -1168,7 +1168,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
| 1168 | ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); | 1168 | ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); |
| 1169 | else | 1169 | else |
| 1170 | mod_timer(&ifmgd->chswitch_timer, | 1170 | mod_timer(&ifmgd->chswitch_timer, |
| 1171 | TU_TO_EXP_TIME(csa_ie.count * cbss->beacon_interval)); | 1171 | TU_TO_EXP_TIME((csa_ie.count - 1) * |
| 1172 | cbss->beacon_interval)); | ||
| 1172 | } | 1173 | } |
| 1173 | 1174 | ||
| 1174 | static bool | 1175 | static bool |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index b04ca4049c95..a37f9af634cb 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -1678,11 +1678,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
| 1678 | sc = le16_to_cpu(hdr->seq_ctrl); | 1678 | sc = le16_to_cpu(hdr->seq_ctrl); |
| 1679 | frag = sc & IEEE80211_SCTL_FRAG; | 1679 | frag = sc & IEEE80211_SCTL_FRAG; |
| 1680 | 1680 | ||
| 1681 | if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || | 1681 | if (likely(!ieee80211_has_morefrags(fc) && frag == 0)) |
| 1682 | is_multicast_ether_addr(hdr->addr1))) { | 1682 | goto out; |
| 1683 | /* not fragmented */ | 1683 | |
| 1684 | if (is_multicast_ether_addr(hdr->addr1)) { | ||
| 1685 | rx->local->dot11MulticastReceivedFrameCount++; | ||
| 1684 | goto out; | 1686 | goto out; |
| 1685 | } | 1687 | } |
| 1688 | |||
| 1686 | I802_DEBUG_INC(rx->local->rx_handlers_fragments); | 1689 | I802_DEBUG_INC(rx->local->rx_handlers_fragments); |
| 1687 | 1690 | ||
| 1688 | if (skb_linearize(rx->skb)) | 1691 | if (skb_linearize(rx->skb)) |
| @@ -1775,10 +1778,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
| 1775 | out: | 1778 | out: |
| 1776 | if (rx->sta) | 1779 | if (rx->sta) |
| 1777 | rx->sta->rx_packets++; | 1780 | rx->sta->rx_packets++; |
| 1778 | if (is_multicast_ether_addr(hdr->addr1)) | 1781 | ieee80211_led_rx(rx->local); |
| 1779 | rx->local->dot11MulticastReceivedFrameCount++; | ||
| 1780 | else | ||
| 1781 | ieee80211_led_rx(rx->local); | ||
| 1782 | return RX_CONTINUE; | 1782 | return RX_CONTINUE; |
| 1783 | } | 1783 | } |
| 1784 | 1784 | ||
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c index 6ab009070084..efeba56c913b 100644 --- a/net/mac80211/spectmgmt.c +++ b/net/mac80211/spectmgmt.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | #include "wme.h" | 22 | #include "wme.h" |
| 23 | 23 | ||
| 24 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | 24 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, |
| 25 | struct ieee802_11_elems *elems, bool beacon, | 25 | struct ieee802_11_elems *elems, |
| 26 | enum ieee80211_band current_band, | 26 | enum ieee80211_band current_band, |
| 27 | u32 sta_flags, u8 *bssid, | 27 | u32 sta_flags, u8 *bssid, |
| 28 | struct ieee80211_csa_ie *csa_ie) | 28 | struct ieee80211_csa_ie *csa_ie) |
| @@ -91,19 +91,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | |||
| 91 | return -EINVAL; | 91 | return -EINVAL; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | if (!beacon && sec_chan_offs) { | 94 | if (sec_chan_offs) { |
| 95 | secondary_channel_offset = sec_chan_offs->sec_chan_offs; | 95 | secondary_channel_offset = sec_chan_offs->sec_chan_offs; |
| 96 | } else if (beacon && ht_oper) { | ||
| 97 | secondary_channel_offset = | ||
| 98 | ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET; | ||
| 99 | } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { | 96 | } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { |
| 100 | /* If it's not a beacon, HT is enabled and the IE not present, | 97 | /* If the secondary channel offset IE is not present, |
| 101 | * it's 20 MHz, 802.11-2012 8.5.2.6: | 98 | * we can't know what's the post-CSA offset, so the |
| 102 | * This element [the Secondary Channel Offset Element] is | 99 | * best we can do is use 20MHz. |
| 103 | * present when switching to a 40 MHz channel. It may be | 100 | */ |
| 104 | * present when switching to a 20 MHz channel (in which | ||
| 105 | * case the secondary channel offset is set to SCN). | ||
| 106 | */ | ||
| 107 | secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | 101 | secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 108 | } | 102 | } |
| 109 | 103 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index f1de72de273e..0007b8180397 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -1440,7 +1440,7 @@ static void netlink_unbind(int group, long unsigned int groups, | |||
| 1440 | return; | 1440 | return; |
| 1441 | 1441 | ||
| 1442 | for (undo = 0; undo < group; undo++) | 1442 | for (undo = 0; undo < group; undo++) |
| 1443 | if (test_bit(group, &groups)) | 1443 | if (test_bit(undo, &groups)) |
| 1444 | nlk->netlink_unbind(undo); | 1444 | nlk->netlink_unbind(undo); |
| 1445 | } | 1445 | } |
| 1446 | 1446 | ||
| @@ -1492,7 +1492,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, | |||
| 1492 | netlink_insert(sk, net, nladdr->nl_pid) : | 1492 | netlink_insert(sk, net, nladdr->nl_pid) : |
| 1493 | netlink_autobind(sock); | 1493 | netlink_autobind(sock); |
| 1494 | if (err) { | 1494 | if (err) { |
| 1495 | netlink_unbind(nlk->ngroups - 1, groups, nlk); | 1495 | netlink_unbind(nlk->ngroups, groups, nlk); |
| 1496 | return err; | 1496 | return err; |
| 1497 | } | 1497 | } |
| 1498 | } | 1498 | } |
| @@ -2509,6 +2509,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, | |||
| 2509 | nl_table[unit].module = module; | 2509 | nl_table[unit].module = module; |
| 2510 | if (cfg) { | 2510 | if (cfg) { |
| 2511 | nl_table[unit].bind = cfg->bind; | 2511 | nl_table[unit].bind = cfg->bind; |
| 2512 | nl_table[unit].unbind = cfg->unbind; | ||
| 2512 | nl_table[unit].flags = cfg->flags; | 2513 | nl_table[unit].flags = cfg->flags; |
| 2513 | if (cfg->compare) | 2514 | if (cfg->compare) |
| 2514 | nl_table[unit].compare = cfg->compare; | 2515 | nl_table[unit].compare = cfg->compare; |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 0e8529113dc5..fb7976aee61c 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
| @@ -862,8 +862,6 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, | |||
| 862 | list_add(&cur_key->key_list, sh_keys); | 862 | list_add(&cur_key->key_list, sh_keys); |
| 863 | 863 | ||
| 864 | cur_key->key = key; | 864 | cur_key->key = key; |
| 865 | sctp_auth_key_hold(key); | ||
| 866 | |||
| 867 | return 0; | 865 | return 0; |
| 868 | nomem: | 866 | nomem: |
| 869 | if (!replace) | 867 | if (!replace) |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index ab734be8cb20..9f32741abb1c 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
| @@ -2609,6 +2609,9 @@ do_addr_param: | |||
| 2609 | addr_param = param.v + sizeof(sctp_addip_param_t); | 2609 | addr_param = param.v + sizeof(sctp_addip_param_t); |
| 2610 | 2610 | ||
| 2611 | af = sctp_get_af_specific(param_type2af(param.p->type)); | 2611 | af = sctp_get_af_specific(param_type2af(param.p->type)); |
| 2612 | if (af == NULL) | ||
| 2613 | break; | ||
| 2614 | |||
| 2612 | af->from_addr_param(&addr, addr_param, | 2615 | af->from_addr_param(&addr, addr_param, |
| 2613 | htons(asoc->peer.port), 0); | 2616 | htons(asoc->peer.port), 0); |
| 2614 | 2617 | ||
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index afb292cd797d..53ed8d3f8897 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
| @@ -1353,6 +1353,7 @@ gss_stringify_acceptor(struct rpc_cred *cred) | |||
| 1353 | char *string = NULL; | 1353 | char *string = NULL; |
| 1354 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, gc_base); | 1354 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, gc_base); |
| 1355 | struct gss_cl_ctx *ctx; | 1355 | struct gss_cl_ctx *ctx; |
| 1356 | unsigned int len; | ||
| 1356 | struct xdr_netobj *acceptor; | 1357 | struct xdr_netobj *acceptor; |
| 1357 | 1358 | ||
| 1358 | rcu_read_lock(); | 1359 | rcu_read_lock(); |
| @@ -1360,15 +1361,39 @@ gss_stringify_acceptor(struct rpc_cred *cred) | |||
| 1360 | if (!ctx) | 1361 | if (!ctx) |
| 1361 | goto out; | 1362 | goto out; |
| 1362 | 1363 | ||
| 1363 | acceptor = &ctx->gc_acceptor; | 1364 | len = ctx->gc_acceptor.len; |
| 1365 | rcu_read_unlock(); | ||
| 1364 | 1366 | ||
| 1365 | /* no point if there's no string */ | 1367 | /* no point if there's no string */ |
| 1366 | if (!acceptor->len) | 1368 | if (!len) |
| 1367 | goto out; | 1369 | return NULL; |
| 1368 | 1370 | realloc: | |
| 1369 | string = kmalloc(acceptor->len + 1, GFP_KERNEL); | 1371 | string = kmalloc(len + 1, GFP_KERNEL); |
| 1370 | if (!string) | 1372 | if (!string) |
| 1373 | return NULL; | ||
| 1374 | |||
| 1375 | rcu_read_lock(); | ||
| 1376 | ctx = rcu_dereference(gss_cred->gc_ctx); | ||
| 1377 | |||
| 1378 | /* did the ctx disappear or was it replaced by one with no acceptor? */ | ||
| 1379 | if (!ctx || !ctx->gc_acceptor.len) { | ||
| 1380 | kfree(string); | ||
| 1381 | string = NULL; | ||
| 1371 | goto out; | 1382 | goto out; |
| 1383 | } | ||
| 1384 | |||
| 1385 | acceptor = &ctx->gc_acceptor; | ||
| 1386 | |||
| 1387 | /* | ||
| 1388 | * Did we find a new acceptor that's longer than the original? Allocate | ||
| 1389 | * a longer buffer and try again. | ||
| 1390 | */ | ||
| 1391 | if (len < acceptor->len) { | ||
| 1392 | len = acceptor->len; | ||
| 1393 | rcu_read_unlock(); | ||
| 1394 | kfree(string); | ||
| 1395 | goto realloc; | ||
| 1396 | } | ||
| 1372 | 1397 | ||
| 1373 | memcpy(string, acceptor->data, acceptor->len); | 1398 | memcpy(string, acceptor->data, acceptor->len); |
| 1374 | string[acceptor->len] = '\0'; | 1399 | string[acceptor->len] = '\0'; |
