From patchwork Thu May 1 19:55:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 344800 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 527811400B5 for ; Fri, 2 May 2014 05:55:14 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751770AbaEATzN (ORCPT ); Thu, 1 May 2014 15:55:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58448 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751706AbaEATzN (ORCPT ); Thu, 1 May 2014 15:55:13 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s41JtC8D010456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 1 May 2014 15:55:13 -0400 Received: from liberator.sandeen.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s41JtBcZ026148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Thu, 1 May 2014 15:55:12 -0400 Message-ID: <5362A6A2.7040504@redhat.com> Date: Thu, 01 May 2014 14:55:14 -0500 From: Eric Sandeen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: ext4 development Subject: [PATCH] mke2fs: don't accept too-high revision levels X-Enigmail-Version: 1.6 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 Reviewed-by: Andreas Dilger --- -- 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 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;