From patchwork Mon Aug 22 21:17:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marcin_=C5=9Alusarz?= X-Patchwork-Id: 1086492 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7MLI6Bt011842 for ; Mon, 22 Aug 2011 21:18:27 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48BBA9ED55 for ; Mon, 22 Aug 2011 14:18:06 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-fx0-f49.google.com (mail-fx0-f49.google.com [209.85.161.49]) by gabe.freedesktop.org (Postfix) with ESMTP id B5F7E9E7B6 for ; Mon, 22 Aug 2011 14:17:56 -0700 (PDT) Received: by fxd20 with SMTP id 20so4665706fxd.36 for ; Mon, 22 Aug 2011 14:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=B88egpDITeReqLs4kr8SuPVl7HLysTl9vUyKjppTftY=; b=Z5XwOWEr0014b+/Hd+FOaOEN74xg1ph/5+GA9u3z9eI+gjQBf/Eb8QgHpvIALdusIu cCb7Si9Y2uzPSebTY7BSIF8GtPMiiHHAz11HXVSne/m/uVqps8q6l8LB4AMkrH/tjtq1 Djr5n+LqsfYM39U55+xTEM6hYFqOXQIrE2fsY= Received: by 10.223.5.76 with SMTP id 12mr4222999fau.103.1314047875815; Mon, 22 Aug 2011 14:17:55 -0700 (PDT) Received: from joi.lan (acet27.neoplus.adsl.tpnet.pl [83.9.195.27]) by mx.google.com with ESMTPS id p11sm3182303faa.46.2011.08.22.14.17.54 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Aug 2011 14:17:54 -0700 (PDT) Date: Mon, 22 Aug 2011 23:17:57 +0200 From: Marcin Slusarz To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/ttm: fix ttm_bo_add_ttm(user) failure path Message-ID: <20110822211757.GB3098@joi.lan> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Thomas Hellstrom X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 22 Aug 2011 21:18:27 +0000 (UTC) ttm_tt_destroy kfrees passed object, so we need to nullify a reference to it. Signed-off-by: Marcin Slusarz Cc: stable@kernel.org Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/ttm/ttm_bo.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 251df77..2e8f929 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -353,8 +353,10 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) ret = ttm_tt_set_user(bo->ttm, current, bo->buffer_start, bo->num_pages); - if (unlikely(ret != 0)) + if (unlikely(ret != 0)) { ttm_tt_destroy(bo->ttm); + bo->ttm = NULL; + } break; default: printk(KERN_ERR TTM_PFX "Illegal buffer object type\n");