From nobody Fri Sep 25 05:30:01 2026 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 914264AE13A; Wed, 16 Sep 2026 09:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789552526; cv=none; b=M+SHDK30KfyC/Vp9LGeRW/sE+ETbgFf0uQpDHX1qRJFK71EVqD9hP3Cdoc4LkpuX0BsH0Ks0JZWlT1CQKE3UH7HQWp9STgbGppIgOuXlpAJMXjz3cc6eoTC7DXcexUAsO4A2RmsMb9V5riM+g8babLeBx+t2i0xKFe3lWSkEIuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789552526; c=relaxed/simple; bh=D9scN90A88NgvXZXUY9ivhOVF2M59ZuH8h4wrYMccu0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=THmXbzTRYrkCu0vMNJTQggTAe+Jy5vz4AQMRYtLtRbiRw4uSdpze5B9/ow0gbWmBoXyNJeABSl4G5IjACFRL4bDJ+nvGCwiAiC4TMzi65AVXL+3ka2aW+p+wQPdCyQP9SCheaTuvHoMN48u+xjsebL3qoAq5Hraqjn3rP5SAKtM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from dfae2b116770.home.arpa (unknown [36.110.52.2]) by APP-03 (Coremail) with SMTP id rQCowABXXDp0Z6pqbrngBw--.37206S2; Wed, 16 Sep 2026 17:55:00 +0800 (CST) From: Wentao Liang To: airlied@gmail.com Cc: alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lijo.lazar@amd.com, linux-kernel@vger.kernel.org, simona@ffwll.ch, Wentao Liang , stable@vger.kernel.org Subject: [PATCH] drm/amdgpu: Fix acpi device leak in amdgpu_acpi_enumerate_xcc() Date: Wed, 16 Sep 2026 09:54:32 +0000 Message-Id: <20260916095432.2009976-1-vulab@iscas.ac.cn> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: rQCowABXXDp0Z6pqbrngBw--.37206S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Kw15ZFy5XF48Zr48GryxuFg_yoW8Jw4Upr 4Sqr15CryDuF12k3yUJanrXF90kay7uryfCrW7ZwnF9w45XFyrXFy5J3Wj9r97AFZ3CFsI yr9rJay8XF1qyF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9a14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE14v26r4UJVWxJr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02 628vn2kIc2xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4 IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1r MI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCV W8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWU JVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJr UvcSsGvfC2KfnxnUUI43ZEXa7VUbtl1PUUUUU== X-CM-SenderInfo: pyxotu46lvutnvoduhdfq/1tbiCRIMA2qqP4ejfgAAsx Content-Type: text/plain; charset="utf-8" amdgpu_acpi_enumerate_xcc() looks up each XCC ACPI device with acpi_dev_get_first_match_dev(), which takes a reference to the device. The reference is dropped with acpi_dev_put() after the XCC info is initialized, but if the kzalloc_obj() allocation of the XCC info fails the function returns -ENOMEM without releasing the reference, leaking the last reference to the ACPI device. Drop the ACPI device reference on the allocation failure path before returning. Fixes: 4d5275ab0b18 ("drm/amdgpu: Add parsing of acpi xcc objects") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang Reviewed-by: Lijo Lazar --- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd= /amdgpu/amdgpu_acpi.c index 516ab9cf88fc..8d3f1f5a141e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -1167,8 +1167,10 @@ int amdgpu_acpi_enumerate_xcc(void) } =20 xcc_info =3D kzalloc_obj(struct amdgpu_acpi_xcc_info); - if (!xcc_info) + if (!xcc_info) { + acpi_dev_put(acpi_dev); return -ENOMEM; + } =20 INIT_LIST_HEAD(&xcc_info->list); xcc_info->handle =3D acpi_device_handle(acpi_dev); --=20 2.34.1