Skip to content

Commit 4621c33

Browse files
committed
Merge tag 'ceph-for-6.19-rc5' of https://github.com/ceph/ceph-client
Pull ceph fixes from Ilya Dryomov: "A bunch of libceph fixes split evenly between memory safety and implementation correctness issues (all marked for stable) and a change in maintainers for CephFS: Slava and Alex have formally taken over Xiubo's role" * tag 'ceph-for-6.19-rc5' of https://github.com/ceph/ceph-client: libceph: make calc_target() set t->paused, not just clear it libceph: reset sparse-read state in osd_fault() libceph: return the handler error from mon_handle_auth_done() libceph: make free_choose_arg_map() resilient to partial allocation ceph: update co-maintainers list in MAINTAINERS libceph: replace overzealous BUG_ON in osdmap_apply_incremental() libceph: prevent potential out-of-bounds reads in handle_auth_done()
2 parents 372800c + c0fe299 commit 4621c33

5 files changed

Lines changed: 34 additions & 14 deletions

File tree

MAINTAINERS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5802,7 +5802,8 @@ F: drivers/power/supply/cw2015_battery.c
58025802

58035803
CEPH COMMON CODE (LIBCEPH)
58045804
M: Ilya Dryomov <idryomov@gmail.com>
5805-
M: Xiubo Li <xiubli@redhat.com>
5805+
M: Alex Markuze <amarkuze@redhat.com>
5806+
M: Viacheslav Dubeyko <slava@dubeyko.com>
58065807
L: ceph-devel@vger.kernel.org
58075808
S: Supported
58085809
W: http://ceph.com/
@@ -5813,8 +5814,9 @@ F: include/linux/crush/
58135814
F: net/ceph/
58145815

58155816
CEPH DISTRIBUTED FILE SYSTEM CLIENT (CEPH)
5816-
M: Xiubo Li <xiubli@redhat.com>
58175817
M: Ilya Dryomov <idryomov@gmail.com>
5818+
M: Alex Markuze <amarkuze@redhat.com>
5819+
M: Viacheslav Dubeyko <slava@dubeyko.com>
58185820
L: ceph-devel@vger.kernel.org
58195821
S: Supported
58205822
W: http://ceph.com/

net/ceph/messenger_v2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,7 +2376,9 @@ static int process_auth_done(struct ceph_connection *con, void *p, void *end)
23762376

23772377
ceph_decode_64_safe(&p, end, global_id, bad);
23782378
ceph_decode_32_safe(&p, end, con->v2.con_mode, bad);
2379+
23792380
ceph_decode_32_safe(&p, end, payload_len, bad);
2381+
ceph_decode_need(&p, end, payload_len, bad);
23802382

23812383
dout("%s con %p global_id %llu con_mode %d payload_len %d\n",
23822384
__func__, con, global_id, con->v2.con_mode, payload_len);

net/ceph/mon_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ static int mon_handle_auth_done(struct ceph_connection *con,
14171417
if (!ret)
14181418
finish_hunting(monc);
14191419
mutex_unlock(&monc->mutex);
1420-
return 0;
1420+
return ret;
14211421
}
14221422

14231423
static int mon_handle_auth_bad_method(struct ceph_connection *con,

net/ceph/osd_client.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,7 @@ static enum calc_target_result calc_target(struct ceph_osd_client *osdc,
15861586
struct ceph_pg_pool_info *pi;
15871587
struct ceph_pg pgid, last_pgid;
15881588
struct ceph_osds up, acting;
1589+
bool should_be_paused;
15891590
bool is_read = t->flags & CEPH_OSD_FLAG_READ;
15901591
bool is_write = t->flags & CEPH_OSD_FLAG_WRITE;
15911592
bool force_resend = false;
@@ -1654,10 +1655,16 @@ static enum calc_target_result calc_target(struct ceph_osd_client *osdc,
16541655
&last_pgid))
16551656
force_resend = true;
16561657

1657-
if (t->paused && !target_should_be_paused(osdc, t, pi)) {
1658-
t->paused = false;
1658+
should_be_paused = target_should_be_paused(osdc, t, pi);
1659+
if (t->paused && !should_be_paused) {
16591660
unpaused = true;
16601661
}
1662+
if (t->paused != should_be_paused) {
1663+
dout("%s t %p paused %d -> %d\n", __func__, t, t->paused,
1664+
should_be_paused);
1665+
t->paused = should_be_paused;
1666+
}
1667+
16611668
legacy_change = ceph_pg_compare(&t->pgid, &pgid) ||
16621669
ceph_osds_changed(&t->acting, &acting,
16631670
t->used_replica || any_change);
@@ -4281,6 +4288,9 @@ static void osd_fault(struct ceph_connection *con)
42814288
goto out_unlock;
42824289
}
42834290

4291+
osd->o_sparse_op_idx = -1;
4292+
ceph_init_sparse_read(&osd->o_sparse_read);
4293+
42844294
if (!reopen_osd(osd))
42854295
kick_osd_requests(osd);
42864296
maybe_request_map(osdc);

net/ceph/osdmap.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,26 @@ static struct crush_choose_arg_map *alloc_choose_arg_map(void)
241241

242242
static void free_choose_arg_map(struct crush_choose_arg_map *arg_map)
243243
{
244-
if (arg_map) {
245-
int i, j;
244+
int i, j;
245+
246+
if (!arg_map)
247+
return;
246248

247-
WARN_ON(!RB_EMPTY_NODE(&arg_map->node));
249+
WARN_ON(!RB_EMPTY_NODE(&arg_map->node));
248250

251+
if (arg_map->args) {
249252
for (i = 0; i < arg_map->size; i++) {
250253
struct crush_choose_arg *arg = &arg_map->args[i];
251-
252-
for (j = 0; j < arg->weight_set_size; j++)
253-
kfree(arg->weight_set[j].weights);
254-
kfree(arg->weight_set);
254+
if (arg->weight_set) {
255+
for (j = 0; j < arg->weight_set_size; j++)
256+
kfree(arg->weight_set[j].weights);
257+
kfree(arg->weight_set);
258+
}
255259
kfree(arg->ids);
256260
}
257261
kfree(arg_map->args);
258-
kfree(arg_map);
259262
}
263+
kfree(arg_map);
260264
}
261265

262266
DEFINE_RB_FUNCS(choose_arg_map, struct crush_choose_arg_map, choose_args_index,
@@ -1979,11 +1983,13 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, bool msgr2,
19791983
sizeof(u64) + sizeof(u32), e_inval);
19801984
ceph_decode_copy(p, &fsid, sizeof(fsid));
19811985
epoch = ceph_decode_32(p);
1982-
BUG_ON(epoch != map->epoch+1);
19831986
ceph_decode_copy(p, &modified, sizeof(modified));
19841987
new_pool_max = ceph_decode_64(p);
19851988
new_flags = ceph_decode_32(p);
19861989

1990+
if (epoch != map->epoch + 1)
1991+
goto e_inval;
1992+
19871993
/* full map? */
19881994
ceph_decode_32_safe(p, end, len, e_inval);
19891995
if (len > 0) {

0 commit comments

Comments
 (0)