diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 5495b1108dff927b97a56934069b3f99c16058fd..2a39b4820ee5a89f262a25547287f5953fbe6bc8 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1462,6 +1462,7 @@ enum seq_op { #define LOV_MIN_STRIPE_SIZE 65536 /* maximum PAGE_SIZE (ia64), power of 2 */ #define LOV_MAX_STRIPE_COUNT 160 /* until bug 4424 is fixed */ +#define LOV_V1_INSANE_STRIPE_COUNT 65532 /* maximum stripe count bz13933 */ #define LOV_MAX_UUID_BUFFER_SIZE 8192 /* The size of the buffer the lov/mdc reserves for the diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 4a9f996f91dca1d1445e57d23ef958ea55d433ea..3c4ac5b1271b05b824be3d36a94aa1a2ecb37ab7 100755 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -51,7 +51,7 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, int stripe_count) { - if (stripe_count == 0) { + if (stripe_count == 0 || stripe_count > LOV_V1_INSANE_STRIPE_COUNT) { CERROR("bad stripe count %d\n", stripe_count); lov_dump_lmm_v1(D_WARNING, lmm); return -EINVAL; diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index c4cf95705cc56c43e3979c8814c2435593610fad..b13a0674dd19dc0267d5db4220ef3ab3483da1f6 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -48,12 +48,20 @@ void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm) CDEBUG(level,"stripe_size %u, stripe_count %u\n", le32_to_cpu(lmm->lmm_stripe_size), le32_to_cpu(lmm->lmm_stripe_count)); - for (i = 0, lod = lmm->lmm_objects; - i < (int)le32_to_cpu(lmm->lmm_stripe_count); i++, lod++) - CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n", - i, le32_to_cpu(lod->l_ost_idx), - le64_to_cpu(lod->l_object_gr), - le64_to_cpu(lod->l_object_id)); + + if (le32_to_cpu(lmm->lmm_stripe_count) <= LOV_V1_INSANE_STRIPE_COUNT) { + for (i = 0, lod = lmm->lmm_objects; + i < (int)le32_to_cpu(lmm->lmm_stripe_count); i++, lod++) + CDEBUG(level, + "stripe %u idx %u subobj "LPX64"/"LPX64"\n", + i, le32_to_cpu(lod->l_ost_idx), + le64_to_cpu(lod->l_object_gr), + le64_to_cpu(lod->l_object_id)); + } else { + CDEBUG(level, "bad stripe_count %u > max_stripe_count %u\n", + le32_to_cpu(lmm->lmm_stripe_count), + LOV_V1_INSANE_STRIPE_COUNT); + } } void lov_dump_lmm_join(int level, struct lov_mds_md_join *lmmj)