diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 05d7878dfad1..f4ce67ac8486 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -203,6 +203,10 @@ static int jffs2_parse_param(struct fs_context *fc, struct fs_parameter *param) if (result.uint_32 > UINT_MAX / 1024) return invalf(fc, "jffs2: rp_size unrepresentable"); opt = result.uint_32 * 1024; + + if (!c->mtd) + return invalf(fc, "jiffs2: mtd device is NULL"); + if (opt > c->mtd->size) return invalf(fc, "jffs2: Too large reserve pool specified, max is %llu KB", c->mtd->size / 1024);