Message ID | 5362A6A2.7040504@redhat.com |
---|---|
State | Superseded, archived |
Headers | show |
Came across this, still not merged, so ping? On 5/1/14 2:55 PM, Eric Sandeen wrote: > It's a bit strange to accept revision levels higher than > the code creating the filesystem can understand, so don't > allow it. > > At least the kernel will mount the fs readonly if it's too > high, but no other utility will touch it, so you can't > fix the error. > > Just reject anything > EXT2_MAX_SUPP_REV at mkfs time. > > Signed-off-by: Eric Sandeen <sandeen@redhat.com> > --- > > diff --git a/misc/mke2fs.c b/misc/mke2fs.c > index aecd5d5..82019dc 100644 > --- a/misc/mke2fs.c > +++ b/misc/mke2fs.c > @@ -1679,9 +1679,10 @@ profile_error: > break; > case 'r': > r_opt = strtoul(optarg, &tmp, 0); > - if (*tmp) { > + if (*tmp || (r_opt > EXT2_MAX_SUPP_REV)) { > com_err(program_name, 0, > - _("bad revision level - %s"), optarg); > + _("bad revision level - %s (max %d)"), > + optarg, EXT2_MAX_SUPP_REV); > exit(1); > } > fs_param.s_rev_level = r_opt; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> On Jan 14, 2016, at 11:35 AM, Eric Sandeen <sandeen@redhat.com> wrote: > > Came across this, still not merged, so ping? > > On 5/1/14 2:55 PM, Eric Sandeen wrote: >> It's a bit strange to accept revision levels higher than >> the code creating the filesystem can understand, so don't >> allow it. >> >> At least the kernel will mount the fs readonly if it's too >> high, but no other utility will touch it, so you can't >> fix the error. >> >> Just reject anything > EXT2_MAX_SUPP_REV at mkfs time. >> >> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> >> --- >> >> diff --git a/misc/mke2fs.c b/misc/mke2fs.c >> index aecd5d5..82019dc 100644 >> --- a/misc/mke2fs.c >> +++ b/misc/mke2fs.c >> @@ -1679,9 +1679,10 @@ profile_error: >> break; >> case 'r': >> r_opt = strtoul(optarg, &tmp, 0); >> - if (*tmp) { >> + if (*tmp || (r_opt > EXT2_MAX_SUPP_REV)) { >> com_err(program_name, 0, >> - _("bad revision level - %s"), optarg); >> + _("bad revision level - %s (max %d)"), >> + optarg, EXT2_MAX_SUPP_REV); >> exit(1); >> } >> fs_param.s_rev_level = r_opt; >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Cheers, Andreas
diff --git a/misc/mke2fs.c b/misc/mke2fs.c index aecd5d5..82019dc 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1679,9 +1679,10 @@ profile_error: break; case 'r': r_opt = strtoul(optarg, &tmp, 0); - if (*tmp) { + if (*tmp || (r_opt > EXT2_MAX_SUPP_REV)) { com_err(program_name, 0, - _("bad revision level - %s"), optarg); + _("bad revision level - %s (max %d)"), + optarg, EXT2_MAX_SUPP_REV); exit(1); } fs_param.s_rev_level = r_opt;
It's a bit strange to accept revision levels higher than the code creating the filesystem can understand, so don't allow it. At least the kernel will mount the fs readonly if it's too high, but no other utility will touch it, so you can't fix the error. Just reject anything > EXT2_MAX_SUPP_REV at mkfs time. Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html