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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA7EEC4332F for ; Fri, 26 Nov 2021 02:34:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CBD726E506; Fri, 26 Nov 2021 02:34:18 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id A501A6E504; Fri, 26 Nov 2021 02:34:17 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D481C61139; Fri, 26 Nov 2021 02:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637894057; bh=/U9FxitpadGD+gXB9HlW7Ev7z2e8KTHdVeMPb3pDD9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mc1jq8f8SLjUCxpdTe2SthvM0fRV27actBnqMwPqxBXjdfyqU3RDUhz5soxlir1ET BH0UEA6PN3eMpyV4Ci73zBsBv2FqeDZe6PIWB7O+xAls3mVbKUfbpdr8lOOwlZKqfp TRty5SyuySkz6gZ0H0SCPZh1jIaazEP1tNZKyio2h323LQWpGw840B8NLQeP4PTWkt SO3C3THKkdAJcgGg0MQad/Zr5RdILVhlAQ356ulVfma7M1T3QHCJcnyXdNQ1LHLiWS iR5vrvZt8al84Dq7Bh2Uh4H1dw40/7icDwnNV3zGF6gttSHCCvYSFpcOSmChDGmmk4 mG7GopDfdZOAg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 19/28] drm/amd/amdgpu: fix potential memleak Date: Thu, 25 Nov 2021 21:33:34 -0500 Message-Id: <20211126023343.442045-19-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211126023343.442045-1-sashal@kernel.org> References: <20211126023343.442045-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , jonathan.kim@amd.com, kevin1.wang@amd.com, airlied@linux.ie, Bernard Zhao , Felix Kuehling , Xinhui.Pan@amd.com, tao.zhou1@amd.com, amd-gfx@lists.freedesktop.org, shaoyun.liu@amd.com, dri-devel@lists.freedesktop.org, Alex Deucher , candice.li@amd.com, john.clements@amd.com, christian.koenig@amd.com, Hawking.Zhang@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bernard Zhao [ Upstream commit 27dfaedc0d321b4ea4e10c53e4679d6911ab17aa ] In function amdgpu_get_xgmi_hive, when kobject_init_and_add failed There is a potential memleak if not call kobject_put. Reviewed-by: Felix Kuehling Signed-off-by: Bernard Zhao Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c index 0526dec1d736e..042c85fc528bb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c @@ -358,6 +358,7 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev) "%s", "xgmi_hive_info"); if (ret) { dev_err(adev->dev, "XGMI: failed initializing kobject for xgmi hive\n"); + kobject_put(&hive->kobj); kfree(hive); hive = NULL; goto pro_end; -- 2.33.0