From patchwork Thu May 1 22:35:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 344825 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 600EB1400F6 for ; Fri, 2 May 2014 08:34:59 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbaEAWe6 (ORCPT ); Thu, 1 May 2014 18:34:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21861 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbaEAWe6 (ORCPT ); Thu, 1 May 2014 18:34:58 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s41MYvCh029659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 1 May 2014 18:34:57 -0400 Received: from liberator.sandeen.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s41MYuha027339 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 1 May 2014 18:34:57 -0400 Message-ID: <5362CC14.2070902@redhat.com> Date: Thu, 01 May 2014 17:35:00 -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 , Frank Sorenson Subject: [PATCH V3] mke2fs: prevent creation of filesystem with unsupported revision References: <5362A6A2.7040504@redhat.com> <5362B105.9080702@redhat.com> In-Reply-To: <5362B105.9080702@redhat.com> X-Enigmail-Version: 1.6 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Frank Sorenson 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: Frank Sorenson [sandeen@redhat.com: Add more verbose commit log] Signed-off-by: Eric Sandeen --- 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 :) -- 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 --- a/misc/mke2fs.c +++ a/misc/mke2fs.c @@ -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 */