From patchwork Fri Apr 7 17:58:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill O'Donnell X-Patchwork-Id: 9670053 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B78BE6021C for ; Fri, 7 Apr 2017 17:58:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B085F28609 for ; Fri, 7 Apr 2017 17:58:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A57BA2860F; Fri, 7 Apr 2017 17:58:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 556E228609 for ; Fri, 7 Apr 2017 17:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932733AbdDGR6Q (ORCPT ); Fri, 7 Apr 2017 13:58:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932552AbdDGR6Q (ORCPT ); Fri, 7 Apr 2017 13:58:16 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 821C67F7C5 for ; Fri, 7 Apr 2017 17:58:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 821C67F7C5 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=billodo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 821C67F7C5 Received: from localhost.localdomain.com (ovpn-123-0.rdu2.redhat.com [10.10.123.0]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E3251710B for ; Fri, 7 Apr 2017 17:58:15 +0000 (UTC) From: Bill O'Donnell To: linux-xfs@vger.kernel.org Subject: [PATCH] xfsprogs: ensure growfs rejects non-existent mount point Date: Fri, 7 Apr 2017 12:58:09 -0500 Message-Id: <20170407175809.8540-1-billodo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 07 Apr 2017 17:58:15 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP xfs_growfs manpage clearly states that the filesystem must be mounted to be grown. Current behavior allows xfs_growfs to proceed if the filesystem /containing/ the path of the desired target is mounted. This is not the specified behavior. Instead, also check the targeted fs argument against the entry found in the fstable lookup. Unless the targeted fs is actually mounted, reject the command. Signed-off-by: Bill O'Donnell --- growfs/xfs_growfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c index a294e14..05630b8 100644 --- a/growfs/xfs_growfs.c +++ b/growfs/xfs_growfs.c @@ -203,7 +203,7 @@ main(int argc, char **argv) fs_table_initialise(0, NULL, 0, NULL); fs = fs_table_lookup(argv[optind], FS_MOUNT_POINT); - if (!fs) { + if (!fs || (strcmp(argv[optind], fs->fs_dir) != 0)) { fprintf(stderr, _("%s: %s is not a mounted XFS filesystem\n"), progname, argv[optind]); return 1;