mke2fs: don't accept too-high revision levels
PATCH 1/1 mke2fs: don't accept too-high revision levels
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.
---
misc/mke2fs.c +3 -2
@@ -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;
PATCH v2 1/1 mke2fs: prevent creation of filesystem with unsupported revision
From: Frank Sorenson <[email protected]>
Don't create a filesystem with an unsupported revision number
---
V2: Frank did this independently, and it's better. I forgot about using com_err here.
misc/mke2fs.c +5 -0
@@ -1684,6 +1684,11 @@ profile_error: _("bad revision level - %s"), optarg);exit (1 ); } +if (r_opt >EXT2_MAX_SUPP_REV ) { +com_err (program_name,EXT2_ET_REV_TOO_HIGH , +_ ("while trying to create revision %d" ), r_opt); +exit (1 ); + } fs_param.s_rev_level = r_opt;break ;case 's' :/* deprecated */
Re: [PATCH V2] mke2fs: prevent creation of filesystem with unsupported revision
Quoted 3 lines · Eric Sandeen
From: Frank Sorenson <[email protected]>
Don't create a filesystem with an unsupported revision number
I like the commit comment on the original patch better...
Cheers, Andreas
Quoted 22 lines
Signed-off-by Frank Sorenson <[email protected]>Signed-off-by Eric Sandeen <[email protected]>---
V2: Frank did this independently, and it's better. I forgot about using
com_errhere.misc/mke2fs.c +5
-1@@ -1684,6 +1684,11 @@ profile_error: _("bad revision level - %s"), optarg);exit (1 ); } +if (r_opt >EXT2_MAX_SUPP_REV ) { +com_err (program_name,EXT2_ET_REV_TOO_HIGH , +_ ("while trying to create revision %d" ), r_opt); +exit (1 ); + } fs_param.s_rev_level = r_opt;break ;case 's' :/* deprecated */ --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas
PATCH v3 1/1 mke2fs: prevent creation of filesystem with unsupported revision
In reply to Eric SandeenFrom: Frank Sorenson <[email protected]>
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.
---
V2: Frank did this independently, and it's better. I forgot about using com_err here.
V3: go back to V1's commit log for Andreas :)
misc/mke2fs.c +5 -0
@@ -1684,6 +1684,11 @@ profile_error: _("bad revision level - %s"), optarg);exit (1 ); } +if (r_opt >EXT2_MAX_SUPP_REV ) { +com_err (program_name,EXT2_ET_REV_TOO_HIGH , +_ ("while trying to create revision %d" ), r_opt); +exit (1 ); + } fs_param.s_rev_level = r_opt;break ;case 's' :/* deprecated */
Theodore Ts'o
AppliedRe: [PATCH V3] mke2fs: prevent creation of filesystem with unsupported revision
Quoted 10 lines · Eric Sandeen
From: Frank Sorenson <[email protected]>
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.
Quoted 5 lines
Just reject anything >
EXT2_MAX_SUPP_REVat mkfs time.Signed-off-by Frank Sorenson <[email protected]>[[email protected]: Add more verbose commit log]Signed-off-by Eric Sandeen <[email protected]>
Thanks, applied.
- Ted
Came across this, still not merged, so ping?
Quoted 36 lines · Eric Sandeen
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_REVat mkfs time.Signed-off-by Eric Sandeen <[email protected]>---
misc/mke2fs.c +3
-3@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Andreas Dilger
Reviewed-byQuoted 17 lines · Eric Sandeen
Came across this, still not merged, so ping?
Quoted 11 lines · Eric Sandeen
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_REVat mkfs time.Signed-off-by Eric Sandeen <[email protected]>
Quoted 20 lines
Quoted 20 lines
---
misc/mke2fs.c +3
-2@@ -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;
Quoted 10 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas