2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-30 16:13:54 +08:00

A number of small fixes for -rc1 Luminous changes plus a readdir race

fix, marked for stable.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABCAAGBQJZb3AkAAoJEEp/3jgCEfOLMAUH/RRRxbY4KL/PUhDXVPf+a+Pf
 groC365undvuCmHCkT1ufrlrh56KE0XUvEKgXJp+r84WS4SC6lxaebD6QvzVtyMM
 KPVnbpCNfKw5KtLB1upMteYY6MGfTk4VTPCav69aNGPrvUxJQB8obvWenPi0rWk/
 knALvlJZbSiZeUDK3Id9cjntTGkClYuUHYJQ1JaZeieB/Xwnr+ZvV4on8ul7gkGX
 B6zdqaM43ZomSl/rJrV/G/MOMNV5uVjBNJmVpfH7KkZQGipW7O+8aDwFaMFAAN7r
 4TQcLf+d3SDjcjVspikCMYr0r0VnbL8hLPGkd7Cus/3jei9GWQHGaQqbZZmcKl8=
 =TPyV
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2017-07-19 08:49:46 -07:00
commit a90c6ac2b5
5 changed files with 33 additions and 22 deletions

View File

@ -271,6 +271,11 @@ out:
if (ret < 0) if (ret < 0)
err = ret; err = ret;
dput(last); dput(last);
/* last_name no longer match cache index */
if (fi->readdir_cache_idx >= 0) {
fi->readdir_cache_idx = -1;
fi->dir_release_count = 0;
}
} }
return err; return err;
} }

View File

@ -10,14 +10,14 @@
#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL #define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
#define DEFINE_CEPH_FEATURE(bit, incarnation, name) \ #define DEFINE_CEPH_FEATURE(bit, incarnation, name) \
const static uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \ static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \
const static uint64_t CEPH_FEATUREMASK_##name = \ static const uint64_t CEPH_FEATUREMASK_##name = \
(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
/* this bit is ignored but still advertised by release *when* */ /* this bit is ignored but still advertised by release *when* */
#define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \ #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
const static uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \ static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
const static uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \ static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \
(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
/* /*

View File

@ -3203,8 +3203,10 @@ static struct ceph_msg_data *ceph_msg_data_create(enum ceph_msg_data_type type)
return NULL; return NULL;
data = kmem_cache_zalloc(ceph_msg_data_cache, GFP_NOFS); data = kmem_cache_zalloc(ceph_msg_data_cache, GFP_NOFS);
if (data) if (!data)
data->type = type; return NULL;
data->type = type;
INIT_LIST_HEAD(&data->links); INIT_LIST_HEAD(&data->links);
return data; return data;

View File

@ -5310,7 +5310,10 @@ static int invalidate_authorizer(struct ceph_connection *con)
static void osd_reencode_message(struct ceph_msg *msg) static void osd_reencode_message(struct ceph_msg *msg)
{ {
encode_request_finish(msg); int type = le16_to_cpu(msg->hdr.type);
if (type == CEPH_MSG_OSD_OP)
encode_request_finish(msg);
} }
static int osd_sign_message(struct ceph_msg *msg) static int osd_sign_message(struct ceph_msg *msg)

View File

@ -338,7 +338,7 @@ static void crush_finalize(struct crush_map *c)
static struct crush_map *crush_decode(void *pbyval, void *end) static struct crush_map *crush_decode(void *pbyval, void *end)
{ {
struct crush_map *c; struct crush_map *c;
int err = -EINVAL; int err;
int i, j; int i, j;
void **p = &pbyval; void **p = &pbyval;
void *start = pbyval; void *start = pbyval;
@ -407,7 +407,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
size = sizeof(struct crush_bucket_straw2); size = sizeof(struct crush_bucket_straw2);
break; break;
default: default:
err = -EINVAL;
goto bad; goto bad;
} }
BUG_ON(size == 0); BUG_ON(size == 0);
@ -439,31 +438,31 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
err = crush_decode_uniform_bucket(p, end, err = crush_decode_uniform_bucket(p, end,
(struct crush_bucket_uniform *)b); (struct crush_bucket_uniform *)b);
if (err < 0) if (err < 0)
goto bad; goto fail;
break; break;
case CRUSH_BUCKET_LIST: case CRUSH_BUCKET_LIST:
err = crush_decode_list_bucket(p, end, err = crush_decode_list_bucket(p, end,
(struct crush_bucket_list *)b); (struct crush_bucket_list *)b);
if (err < 0) if (err < 0)
goto bad; goto fail;
break; break;
case CRUSH_BUCKET_TREE: case CRUSH_BUCKET_TREE:
err = crush_decode_tree_bucket(p, end, err = crush_decode_tree_bucket(p, end,
(struct crush_bucket_tree *)b); (struct crush_bucket_tree *)b);
if (err < 0) if (err < 0)
goto bad; goto fail;
break; break;
case CRUSH_BUCKET_STRAW: case CRUSH_BUCKET_STRAW:
err = crush_decode_straw_bucket(p, end, err = crush_decode_straw_bucket(p, end,
(struct crush_bucket_straw *)b); (struct crush_bucket_straw *)b);
if (err < 0) if (err < 0)
goto bad; goto fail;
break; break;
case CRUSH_BUCKET_STRAW2: case CRUSH_BUCKET_STRAW2:
err = crush_decode_straw2_bucket(p, end, err = crush_decode_straw2_bucket(p, end,
(struct crush_bucket_straw2 *)b); (struct crush_bucket_straw2 *)b);
if (err < 0) if (err < 0)
goto bad; goto fail;
break; break;
} }
} }
@ -474,7 +473,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
u32 yes; u32 yes;
struct crush_rule *r; struct crush_rule *r;
err = -EINVAL;
ceph_decode_32_safe(p, end, yes, bad); ceph_decode_32_safe(p, end, yes, bad);
if (!yes) { if (!yes) {
dout("crush_decode NO rule %d off %x %p to %p\n", 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)
/* len */ /* len */
ceph_decode_32_safe(p, end, yes, bad); ceph_decode_32_safe(p, end, yes, bad);
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
err = -EINVAL;
if (yes > (ULONG_MAX - sizeof(*r)) if (yes > (ULONG_MAX - sizeof(*r))
/ sizeof(struct crush_rule_step)) / sizeof(struct crush_rule_step))
goto bad; goto bad;
@ -557,7 +554,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
if (*p != end) { if (*p != end) {
err = decode_choose_args(p, end, c); err = decode_choose_args(p, end, c);
if (err) if (err)
goto bad; goto fail;
} }
done: done:
@ -567,10 +564,14 @@ done:
badmem: badmem:
err = -ENOMEM; err = -ENOMEM;
bad: fail:
dout("crush_decode fail %d\n", err); dout("crush_decode fail %d\n", err);
crush_destroy(c); crush_destroy(c);
return ERR_PTR(err); return ERR_PTR(err);
bad:
err = -EINVAL;
goto fail;
} }
int ceph_pg_compare(const struct ceph_pg *lhs, const struct ceph_pg *rhs) 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,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval); ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval);
pg = kzalloc(sizeof(*pg) + 2 * len * sizeof(u32), GFP_NOIO); pg = alloc_pg_mapping(2 * len * sizeof(u32));
if (!pg) if (!pg)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
@ -1544,7 +1545,7 @@ static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
if (struct_v >= 3) { if (struct_v >= 3) {
/* erasure_code_profiles */ /* erasure_code_profiles */
ceph_decode_skip_map_of_map(p, end, string, string, string, ceph_decode_skip_map_of_map(p, end, string, string, string,
bad); e_inval);
} }
if (struct_v >= 4) { if (struct_v >= 4) {
@ -1825,9 +1826,9 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
if (struct_v >= 3) { if (struct_v >= 3) {
/* new_erasure_code_profiles */ /* new_erasure_code_profiles */
ceph_decode_skip_map_of_map(p, end, string, string, string, ceph_decode_skip_map_of_map(p, end, string, string, string,
bad); e_inval);
/* old_erasure_code_profiles */ /* old_erasure_code_profiles */
ceph_decode_skip_set(p, end, string, bad); ceph_decode_skip_set(p, end, string, e_inval);
} }
if (struct_v >= 4) { if (struct_v >= 4) {