From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEA0CEB64DA for ; Thu, 22 Jun 2023 10:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbjFVKVp (ORCPT ); Thu, 22 Jun 2023 06:21:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231492AbjFVKVO (ORCPT ); Thu, 22 Jun 2023 06:21:14 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD5291FDC; Thu, 22 Jun 2023 03:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687429262; x=1718965262; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nsBrKyprDyQqXkX1mcuTIRsLusoyhrCBKqlpyi/2hsM=; b=RuQakajhlC/z47dEopc3dERRKZqhayFPutDZOmVx0idhQQPCkAhu3Qs1 3LCjsgR0QokJ//T4U519g12VXVK+B3dkEulJ//boUvxEDZAKwDmad/MNY rR1d4Glt5W8Mwu+nuJM37uZ3WMj4nqssphgHcCIGnAAwDEPahBHIuw97q A9Cl+lhOEibBIN6CQmCF0J06Ra+f1eprH4Sm51y1kD8tCx4mc8ODos1+S yiC1ZjNxwob4aZyMREao9xiZByV6QEnj0qxkR8WXkoG4u+mnghzSst8/D SuQyig1+/R81hwtpiqeUz4ZpBfB1JiBRlog00FzSzZtvi6QJYY+KgsRCn g==; X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="345182396" X-IronPort-AV: E=Sophos;i="6.00,263,1681196400"; d="scan'208";a="345182396" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2023 03:15:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="692194650" X-IronPort-AV: E=Sophos;i="6.00,263,1681196400"; d="scan'208";a="692194650" Received: from shari19x-mobl1.gar.corp.intel.com (HELO thellstr-mobl1.intel.com) ([10.249.254.173]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2023 03:15:07 -0700 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= To: intel-xe@lists.freedesktop.org Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , dri-devel@lists.freedesktop.org, stable@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] drm/ttm: Don't leak a resource on swapout move error Date: Thu, 22 Jun 2023 12:14:12 +0200 Message-Id: <20230622101412.78426-5-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622101412.78426-1-thomas.hellstrom@linux.intel.com> References: <20230622101412.78426-1-thomas.hellstrom@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org If moving the bo to system for swapout failed, we were leaking a resource. Fix. Fixes: bfa3357ef9ab ("drm/ttm: allocate resource object instead of embedding it v2") Cc: Christian König Cc: "Christian König" Cc: dri-devel@lists.freedesktop.org Cc: # v5.14+ Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 89530f2a027f..d737ddd7f4c0 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1166,6 +1166,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, ret = ttm_bo_handle_move_mem(bo, evict_mem, true, ctx, &hop); if (unlikely(ret != 0)) { WARN(ret == -EMULTIHOP, "Unexpected multihop in swaput - likely driver bug.\n"); + ttm_resource_free(bo, &evict_mem); goto out; } } -- 2.40.1