Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15890578rwd; Mon, 26 Jun 2023 02:49:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yKgTnD24uoWXVeOZQmY32qLsR3QEJSkklU7ktNMPrRgyxqGMxhUqSj73L5aODrSh3SIvW X-Received: by 2002:a17:907:a41f:b0:98f:9934:9b25 with SMTP id sg31-20020a170907a41f00b0098f99349b25mr2655997ejc.23.1687772955154; Mon, 26 Jun 2023 02:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687772955; cv=none; d=google.com; s=arc-20160816; b=qTzycVLYXYyYmbRs1f+v+05wgBmFwYLVzzerG+ABw8TBc1PJLkLoKxEXhIhZji8dav djrdTEAAfKQjeIP5V9ybrHtbaQ0YCUERTt4pC9Y31BPub5Fy2uYH84838QJfgRo67L2R dfbU7WVHT+b0zk+bCu1xMiyAcBUwYEvswvcffskXFt4395hD8e98eHvFlSA5P803t7ou TWgm/cPSlbHeq9fyc6f5Tuly5NqfOyv3NfVyhjb5dR07kCLmZXTTF2KlBnQkDPoDwsSB BLMcLTOQKxKiheWcRCD42sP2AE3Vecf8jYykUa8sHjNOdlcoDR6Wlfl8mrjs4ocKTrhE 2KOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TArM3Ko4khSy5RhyHM6+G8UV7Jl9cDJVDj9qUdwG0h4=; fh=/VBxUd0WYMkn8ad4RYtzu99JQts7xVVOOzOERKSPMhE=; b=XVP6MMxjRt6KZhTIHgOOMkrI9+NtVgQZnb/Sd4Fb2rt3PcTtWyTiYc6KoMB1PqAwBG AXWH1P8mbU0ka00NYXEwYYBrOIy2WukK1BPtJw0Ye+MNepKzaTlXc8w0mOxIUJJozEhw giqUdmz4hvQiMtNf77gGq0jTt6a3Cenh4yDDNhNsdUGYl34S2UR811eOVt50TL3pkhHi Nzq/YtEDG42EiQBnIg3xJuI8k8FJCqcK1tx4tFcVbJWq3fXeTgtkPRmYG6V/i6EfLD96 WdmBsesCdPVGo6Mi+Gjou5BGpj/vAnfMaRDETFbV9Zj+wqs+lK5+R6bQLkrUNmuLYSw4 avZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QSk1xxcr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a170906840300b0098ed8a311besi1326329ejx.114.2023.06.26.02.48.48; Mon, 26 Jun 2023 02:49:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QSk1xxcr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbjFZJUZ (ORCPT + 99 others); Mon, 26 Jun 2023 05:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjFZJTV (ORCPT ); Mon, 26 Jun 2023 05:19:21 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBB5A3C1E; Mon, 26 Jun 2023 02:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687771002; x=1719307002; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=63Y0TPem7frMMGW3N/FgR3d/cjkXyqdp+LijdVM6QYA=; b=QSk1xxcr2jgUsY9vkBuh/5wj0nYFU5HO9HZ5QCf5OYH/THgNy1QCFxmC ys+fH+YyfbQdF1ZrfpO9FwrToj+l9K9aOTs9v3y5iB/lxajcMo1ImuSh7 nx5QZhw9ndYWQe6YIekKezLlzQlUbR00vvzzOE+5bIl3OaGDdpuvtaK2x D+z5DZsNCfKkOT6TA1g3cyrBqukGD6EVb2+mp6A8kRmNzoYxCYcNceYKa 0MHuOotKKjK+iDSAfjX9Y+IcPKIqvRk43tpUXBG7I4iPRm3eKXdSibx5p HoKwqaO7XeRBZ3UeK6JCZNk3m980qi5wM3yIJpSg8GSiYd0oCdtwKPzTz Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="345974135" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="345974135" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 02:15:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="781357838" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="781357838" Received: from ettammin-mobl1.ger.corp.intel.com (HELO thellstr-mobl1.intel.com) ([10.249.254.105]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 02:15:11 -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, Nirmoy Das , Andi Shyti , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] drm/ttm: Don't leak a resource on swapout move error Date: Mon, 26 Jun 2023 11:14:50 +0200 Message-Id: <20230626091450.14757-5-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230626091450.14757-1-thomas.hellstrom@linux.intel.com> References: <20230626091450.14757-1-thomas.hellstrom@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Reviewed-by: Nirmoy Das Reviewed-by: Andi Shyti --- 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 c0e3bbd21d3d..d9a8f227f310 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