From patchwork Fri Nov 7 18:43:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Meyer X-Patchwork-Id: 5262191 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B033DC11AC for ; Mon, 10 Nov 2014 01:24:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAE0D20172 for ; Mon, 10 Nov 2014 01:24:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7DFB320108 for ; Mon, 10 Nov 2014 01:23:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D6D2C6EC31; Sun, 9 Nov 2014 17:23:46 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1231 seconds by postgrey-1.34 at gabe; Fri, 07 Nov 2014 11:04:39 PST Received: from www17.your-server.de (www17.your-server.de [213.133.104.17]) by gabe.freedesktop.org (Postfix) with ESMTP id C5AF7898F1 for ; Fri, 7 Nov 2014 11:04:39 -0800 (PST) Received: from [84.59.134.133] (helo=[192.168.2.108]) by www17.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.80.1) (envelope-from ) id 1XmoVy-00021L-Qm; Fri, 07 Nov 2014 19:44:06 +0100 Message-ID: <1415385784.6136.7.camel@localhost.localdomain> Subject: [PATCH] Fix SIGSEGV in libdrm for heigth = 0 and width = 0 From: Thomas Meyer To: dri-devel@lists.freedesktop.org Date: Fri, 07 Nov 2014 19:43:04 +0100 Mime-Version: 1.0 X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) X-Authenticated-Sender: thomas@m3y3r.de X-Virus-Scanned: Clear (ClamAV 0.98.4/19596/Fri Nov 7 17:38:50 2014) X-Mailman-Approved-At: Sun, 09 Nov 2014 17:23:38 -0800 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP drm_intel_gem_bo_free() crashes because the list bo_gem->vma_list is not yet initialised, but the error path tries to free it. See also https://bugs.freedesktop.org/show_bug.cgi?id=75844 Reviewed-by: Chris Wilson Signed-off-by: Thomas Meyer diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index f2f4fea..b3e9dba 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -759,15 +759,16 @@ retry: bo_gem->swizzle_mode = I915_BIT_6_SWIZZLE_NONE; bo_gem->stride = 0; + /* drm_intel_gem_bo_free calls DRMLISTDEL() for an uninitialized + list (vma_list), so better set the list head here */ + DRMINITLISTHEAD(&bo_gem->name_list); + DRMINITLISTHEAD(&bo_gem->vma_list); if (drm_intel_gem_bo_set_tiling_internal(&bo_gem->bo, tiling_mode, stride)) { drm_intel_gem_bo_free(&bo_gem->bo); return NULL; } - - DRMINITLISTHEAD(&bo_gem->name_list); - DRMINITLISTHEAD(&bo_gem->vma_list); } bo_gem->name = name;