From patchwork Fri Jun 15 22:39:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10467791 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 004A4600F4 for ; Fri, 15 Jun 2018 22:39:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D538F28EA8 for ; Fri, 15 Jun 2018 22:39:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C821528EAC; Fri, 15 Jun 2018 22:39:43 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 8558C28EA8 for ; Fri, 15 Jun 2018 22:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756607AbeFOWjn (ORCPT ); Fri, 15 Jun 2018 18:39:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40512 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756583AbeFOWjm (ORCPT ); Fri, 15 Jun 2018 18:39:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9879930832EC for ; Fri, 15 Jun 2018 22:39:42 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D4C1866BC for ; Fri, 15 Jun 2018 22:39:42 +0000 (UTC) To: linux-xfs From: Eric Sandeen Subject: [PATCH] mkfs: check config realpath for errors Message-ID: <7f95001f-8fb9-3965-0b40-05c434f39607@redhat.com> Date: Fri, 15 Jun 2018 17:39:41 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 15 Jun 2018 22:39:42 +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 Signed-off-by: Eric Sandeen Reviewed-by: Luis R. Rodriguez --- -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" 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/mkfs/config.c b/mkfs/config.c index 3a389ad..9954691 100644 --- a/mkfs/config.c +++ b/mkfs/config.c @@ -573,7 +573,8 @@ open_config_file( goto out; } /* Get absolute path to this file */ - realpath(config_file, *fpath); + if (!realpath(config_file, *fpath)) + goto out; fd = openat(AT_FDCWD, config_file, O_NOFOLLOW, O_RDONLY); }