diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-19 11:49:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-19 11:49:46 -0400 |
| commit | a90c6ac2b5651b1f907de512c2fa648c9fa6bb6e (patch) | |
| tree | bf9d9d2a1aae7c2702a81b45e930b2aa5963778f | |
| parent | 74cbd96bc2e00f5daa805e2ebf49e998f7045062 (diff) | |
| parent | 7c40b22f6f84c98a1d36e6d0a4346e58f05e45d8 (diff) | |
Merge tag 'ceph-for-4.13-rc2' of git://github.com/ceph/ceph-client
Pull ceph fixes from Ilya Dryomov:
"A number of small fixes for -rc1 Luminous changes plus a readdir race
fix, marked for stable"
* tag 'ceph-for-4.13-rc2' of git://github.com/ceph/ceph-client:
libceph: potential NULL dereference in ceph_msg_data_create()
ceph: fix race in concurrent readdir
libceph: don't call encode_request_finish() on MOSDBackoff messages
libceph: use alloc_pg_mapping() in __decode_pg_upmap_items()
libceph: set -EINVAL in one place in crush_decode()
libceph: NULL deref on osdmap_apply_incremental() error path
libceph: fix old style declaration warnings
| -rw-r--r-- | fs/ceph/dir.c | 5 | ||||
| -rw-r--r-- | include/linux/ceph/ceph_features.h | 8 | ||||
| -rw-r--r-- | net/ceph/messenger.c | 6 | ||||
| -rw-r--r-- | net/ceph/osd_client.c | 5 | ||||
| -rw-r--r-- | net/ceph/osdmap.c | 31 |
5 files changed, 33 insertions, 22 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index e071d23f6148..ef7240ace576 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
| @@ -271,6 +271,11 @@ out: | |||
| 271 | if (ret < 0) | 271 | if (ret < 0) |
| 272 | err = ret; | 272 | err = ret; |
| 273 | dput(last); | 273 | dput(last); |
| 274 | /* last_name no longer match cache index */ | ||
| 275 | if (fi->readdir_cache_idx >= 0) { | ||
| 276 | fi->readdir_cache_idx = -1; | ||
| 277 | fi->dir_release_count = 0; | ||
| 278 | } | ||
| 274 | } | 279 | } |
| 275 | return err; | 280 | return err; |
| 276 | } | 281 | } |
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h index f0f6c537b64c..040dd105c3e7 100644 --- a/include/linux/ceph/ceph_features.h +++ b/include/linux/ceph/ceph_features.h | |||
| @@ -10,14 +10,14 @@ | |||
| 10 | #define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL | 10 | #define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL |
| 11 | 11 | ||
| 12 | #define DEFINE_CEPH_FEATURE(bit, incarnation, name) \ | 12 | #define DEFINE_CEPH_FEATURE(bit, incarnation, name) \ |
| 13 | const static uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \ | 13 | static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \ |
| 14 | const static uint64_t CEPH_FEATUREMASK_##name = \ | 14 | static const uint64_t CEPH_FEATUREMASK_##name = \ |
| 15 | (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); | 15 | (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); |
| 16 | 16 | ||
| 17 | /* this bit is ignored but still advertised by release *when* */ | 17 | /* this bit is ignored but still advertised by release *when* */ |
| 18 | #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \ | 18 | #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \ |
| 19 | const static uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \ | 19 | static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \ |
| 20 | const static uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \ | 20 | static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \ |
| 21 | (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); | 21 | (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); |
| 22 | 22 | ||
| 23 | /* | 23 | /* |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 0c31035bbfee..b7cc615d42ef 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
| @@ -3203,8 +3203,10 @@ static struct ceph_msg_data *ceph_msg_data_create(enum ceph_msg_data_type type) | |||
| 3203 | return NULL; | 3203 | return NULL; |
| 3204 | 3204 | ||
| 3205 | data = kmem_cache_zalloc(ceph_msg_data_cache, GFP_NOFS); | 3205 | data = kmem_cache_zalloc(ceph_msg_data_cache, GFP_NOFS); |
| 3206 | if (data) | 3206 | if (!data) |
| 3207 | data->type = type; | 3207 | return NULL; |
| 3208 | |||
| 3209 | data->type = type; | ||
| 3208 | INIT_LIST_HEAD(&data->links); | 3210 | INIT_LIST_HEAD(&data->links); |
| 3209 | 3211 | ||
| 3210 | return data; | 3212 | return data; |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 86a9737d8e3f..901bb8221366 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
| @@ -5310,7 +5310,10 @@ static int invalidate_authorizer(struct ceph_connection *con) | |||
| 5310 | 5310 | ||
| 5311 | static void osd_reencode_message(struct ceph_msg *msg) | 5311 | static void osd_reencode_message(struct ceph_msg *msg) |
| 5312 | { | 5312 | { |
| 5313 | encode_request_finish(msg); | 5313 | int type = le16_to_cpu(msg->hdr.type); |
| 5314 | |||
| 5315 | if (type == CEPH_MSG_OSD_OP) | ||
| 5316 | encode_request_finish(msg); | ||
| 5314 | } | 5317 | } |
| 5315 | 5318 | ||
| 5316 | static int osd_sign_message(struct ceph_msg *msg) | 5319 | static int osd_sign_message(struct ceph_msg *msg) |
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 864789c5974e..64ae9f89773a 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
| @@ -338,7 +338,7 @@ static void crush_finalize(struct crush_map *c) | |||
| 338 | static struct crush_map *crush_decode(void *pbyval, void *end) | 338 | static struct crush_map *crush_decode(void *pbyval, void *end) |
| 339 | { | 339 | { |
| 340 | struct crush_map *c; | 340 | struct crush_map *c; |
| 341 | int err = -EINVAL; | 341 | int err; |
| 342 | int i, j; | 342 | int i, j; |
| 343 | void **p = &pbyval; | 343 | void **p = &pbyval; |
| 344 | void *start = pbyval; | 344 | void *start = pbyval; |
| @@ -407,7 +407,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end) | |||
| 407 | size = sizeof(struct crush_bucket_straw2); | 407 | size = sizeof(struct crush_bucket_straw2); |
| 408 | break; | 408 | break; |
| 409 | default: | 409 | default: |
| 410 | err = -EINVAL; | ||
| 411 | goto bad; | 410 | goto bad; |
| 412 | } | 411 | } |
| 413 | BUG_ON(size == 0); | 412 | BUG_ON(size == 0); |
| @@ -439,31 +438,31 @@ static struct crush_map *crush_decode(void *pbyval, void *end) | |||
| 439 | err = crush_decode_uniform_bucket(p, end, | 438 | err = crush_decode_uniform_bucket(p, end, |
| 440 | (struct crush_bucket_uniform *)b); | 439 | (struct crush_bucket_uniform *)b); |
| 441 | if (err < 0) | 440 | if (err < 0) |
| 442 | goto bad; | 441 | goto fail; |
| 443 | break; | 442 | break; |
| 444 | case CRUSH_BUCKET_LIST: | 443 | case CRUSH_BUCKET_LIST: |
| 445 | err = crush_decode_list_bucket(p, end, | 444 | err = crush_decode_list_bucket(p, end, |
| 446 | (struct crush_bucket_list *)b); | 445 | (struct crush_bucket_list *)b); |
| 447 | if (err < 0) | 446 | if (err < 0) |
| 448 | goto bad; | 447 | goto fail; |
| 449 | break; | 448 | break; |
| 450 | case CRUSH_BUCKET_TREE: | 449 | case CRUSH_BUCKET_TREE: |
| 451 | err = crush_decode_tree_bucket(p, end, | 450 | err = crush_decode_tree_bucket(p, end, |
| 452 | (struct crush_bucket_tree *)b); | 451 | (struct crush_bucket_tree *)b); |
| 453 | if (err < 0) | 452 | if (err < 0) |
| 454 | goto bad; | 453 | goto fail; |
| 455 | break; | 454 | break; |
| 456 | case CRUSH_BUCKET_STRAW: | 455 | case CRUSH_BUCKET_STRAW: |
| 457 | err = crush_decode_straw_bucket(p, end, | 456 | err = crush_decode_straw_bucket(p, end, |
| 458 | (struct crush_bucket_straw *)b); | 457 | (struct crush_bucket_straw *)b); |
| 459 | if (err < 0) | 458 | if (err < 0) |
| 460 | goto bad; | 459 | goto fail; |
| 461 | break; | 460 | break; |
| 462 | case CRUSH_BUCKET_STRAW2: | 461 | case CRUSH_BUCKET_STRAW2: |
| 463 | err = crush_decode_straw2_bucket(p, end, | 462 | err = crush_decode_straw2_bucket(p, end, |
| 464 | (struct crush_bucket_straw2 *)b); | 463 | (struct crush_bucket_straw2 *)b); |
| 465 | if (err < 0) | 464 | if (err < 0) |
| 466 | goto bad; | 465 | goto fail; |
| 467 | break; | 466 | break; |
| 468 | } | 467 | } |
| 469 | } | 468 | } |
| @@ -474,7 +473,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end) | |||
| 474 | u32 yes; | 473 | u32 yes; |
| 475 | struct crush_rule *r; | 474 | struct crush_rule *r; |
| 476 | 475 | ||
| 477 | err = -EINVAL; | ||
| 478 | ceph_decode_32_safe(p, end, yes, bad); | 476 | ceph_decode_32_safe(p, end, yes, bad); |
| 479 | if (!yes) { | 477 | if (!yes) { |
| 480 | dout("crush_decode NO rule %d off %x %p to %p\n", | 478 | dout("crush_decode NO rule %d off %x %p to %p\n", |
| @@ -489,7 +487,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end) | |||
| 489 | /* len */ | 487 | /* len */ |
| 490 | ceph_decode_32_safe(p, end, yes, bad); | 488 | ceph_decode_32_safe(p, end, yes, bad); |
| 491 | #if BITS_PER_LONG == 32 | 489 | #if BITS_PER_LONG == 32 |
| 492 | err = -EINVAL; | ||
| 493 | if (yes > (ULONG_MAX - sizeof(*r)) | 490 | if (yes > (ULONG_MAX - sizeof(*r)) |
| 494 | / sizeof(struct crush_rule_step)) | 491 | / sizeof(struct crush_rule_step)) |
| 495 | goto bad; | 492 | goto bad; |
| @@ -557,7 +554,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end) | |||
| 557 | if (*p != end) { | 554 | if (*p != end) { |
| 558 | err = decode_choose_args(p, end, c); | 555 | err = decode_choose_args(p, end, c); |
| 559 | if (err) | 556 | if (err) |
| 560 | goto bad; | 557 | goto fail; |
| 561 | } | 558 | } |
| 562 | 559 | ||
| 563 | done: | 560 | done: |
| @@ -567,10 +564,14 @@ done: | |||
| 567 | 564 | ||
| 568 | badmem: | 565 | badmem: |
| 569 | err = -ENOMEM; | 566 | err = -ENOMEM; |
| 570 | bad: | 567 | fail: |
| 571 | dout("crush_decode fail %d\n", err); | 568 | dout("crush_decode fail %d\n", err); |
| 572 | crush_destroy(c); | 569 | crush_destroy(c); |
| 573 | return ERR_PTR(err); | 570 | return ERR_PTR(err); |
| 571 | |||
| 572 | bad: | ||
| 573 | err = -EINVAL; | ||
| 574 | goto fail; | ||
| 574 | } | 575 | } |
| 575 | 576 | ||
| 576 | int ceph_pg_compare(const struct ceph_pg *lhs, const struct ceph_pg *rhs) | 577 | int ceph_pg_compare(const struct ceph_pg *lhs, const struct ceph_pg *rhs) |
| @@ -1399,7 +1400,7 @@ static struct ceph_pg_mapping *__decode_pg_upmap_items(void **p, void *end, | |||
