From patchwork Fri Jun 3 15:06:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 9153311 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 BDAB46072B for ; Fri, 3 Jun 2016 15:02:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF84426D17 for ; Fri, 3 Jun 2016 15:02:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3ECA282E8; Fri, 3 Jun 2016 15:02:59 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E06A26D17 for ; Fri, 3 Jun 2016 15:02:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65ABA6E4D3; Fri, 3 Jun 2016 15:02:57 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id B0AA16EDC4 for ; Fri, 3 Jun 2016 15:02:55 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 03 Jun 2016 08:02:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,412,1459839600"; d="scan'208";a="994608755" Received: from mcvlad-wk.rb.intel.com ([10.237.105.57]) by fmsmga002.fm.intel.com with ESMTP; 03 Jun 2016 08:02:43 -0700 From: Marius Vlad To: intel-gfx@lists.freedesktop.org Date: Fri, 3 Jun 2016 18:06:19 +0300 Message-Id: <1464966379-20382-1-git-send-email-marius.c.vlad@intel.com> X-Mailer: git-send-email 2.8.0.rc3 Subject: [Intel-gfx] [PATCH i-g-t] lib/igt_kms: Fix passing invalid fd to openat(2). X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Introduced by 0e11befe442. openat(2) uses a relative path. Fix by passing the correct fd. Signed-off-by: Marius Vlad CC: Chris Wilson Reviewed-by: Chris Wilson --- lib/igt_kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index b12a5b3..135c7b8 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -641,7 +641,8 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, return false; } - if (!igt_sysfs_set(drm_fd, path, value)) { + /* use the fd returned by igt_sysfs_open() */ + if (!igt_sysfs_set(dir, path, value)) { close(dir); return false; }