Skip to content

Commit e00c3f7

Browse files
committed
libceph: replace overzealous BUG_ON in osdmap_apply_incremental()
If the osdmap is (maliciously) corrupted such that the incremental osdmap epoch is different from what is expected, there is no need to BUG. Instead, just declare the incremental osdmap to be invalid. Cc: stable@vger.kernel.org Reported-by: ziming zhang <ezrakiez@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 818156c commit e00c3f7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

net/ceph/osdmap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,11 +1979,13 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, bool msgr2,
19791979
sizeof(u64) + sizeof(u32), e_inval);
19801980
ceph_decode_copy(p, &fsid, sizeof(fsid));
19811981
epoch = ceph_decode_32(p);
1982-
BUG_ON(epoch != map->epoch+1);
19831982
ceph_decode_copy(p, &modified, sizeof(modified));
19841983
new_pool_max = ceph_decode_64(p);
19851984
new_flags = ceph_decode_32(p);
19861985

1986+
if (epoch != map->epoch + 1)
1987+
goto e_inval;
1988+
19871989
/* full map? */
19881990
ceph_decode_32_safe(p, end, len, e_inval);
19891991
if (len > 0) {

0 commit comments

Comments
 (0)