From patchwork Sat Jan 14 00:07:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 9517637 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 43099601B7 for ; Sun, 15 Jan 2017 19:10:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D38528343 for ; Sun, 15 Jan 2017 19:10:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31FA428354; Sun, 15 Jan 2017 19:10:57 +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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B09BF28384 for ; Sun, 15 Jan 2017 19:10:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B15AA6E1E4; Sun, 15 Jan 2017 19:10:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 804756E0DA for ; Sat, 14 Jan 2017 00:09:37 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 13 Jan 2017 16:09:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.33,224,1477983600"; d="scan'208"; a="1112443818" Received: from downor-z87x-ud5h.fm.intel.com ([10.1.122.4]) by fmsmga002.fm.intel.com with ESMTP; 13 Jan 2017 16:09:36 -0800 From: Dongwon Kim To: dri-devel@lists.freedesktop.org Subject: [PATCH] intel: update global_name before HASH_ADD Date: Fri, 13 Jan 2017 16:07:00 -0800 Message-Id: <1484352420-9522-1-git-send-email-dongwon.kim@intel.com> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Sun, 15 Jan 2017 19:10:51 +0000 Cc: Dongwon Kim X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP bo->global_name should be updated first before a hash value for the entry is calculated with it by HASH_ADD macro. Signed-off-by: Dongwon Kim --- intel/intel_bufmgr_gem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 75949b9..c47cb9b 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -2736,11 +2736,12 @@ drm_intel_gem_bo_flink(drm_intel_bo *bo, uint32_t * name) pthread_mutex_lock(&bufmgr_gem->lock); if (!bo_gem->global_name) { + bo_gem->global_name = flink.name; + bo_gem->reusable = false; + HASH_ADD(name_hh, bufmgr_gem->name_table, global_name, sizeof(bo_gem->global_name), bo_gem); - bo_gem->global_name = flink.name; - bo_gem->reusable = false; } pthread_mutex_unlock(&bufmgr_gem->lock); }