From nobody Mon Feb 9 03:58:52 2026 Received: from mail-m49197.qiye.163.com (mail-m49197.qiye.163.com [45.254.49.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33FE7377562 for ; Thu, 29 Jan 2026 08:35:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769675732; cv=none; b=tUqxBb4tpxMIxjl6Safs+akkrgwjT8lNSBj9PoGbUIh0e4P7LjM0Axop4/SIRpnSJ2Z2EST9yUsEFP+e3GB30pFoeZAXq3tQbGzpqJwYGi4UxaSPmVkYBlYpnHgh5WC6y0PsD3o1NaT25fMmnpH7F5mfC7E7JMy9feVkPC1LB10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769675732; c=relaxed/simple; bh=YeyCBwHkVgA9rJI8pN6URCbZnOaFqBiNUrJycfdNUd0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kwVwyUxhChCuv6+VF+Q45AES96PrZE6JdXw27jdSCytqCpdwUHf+eC32u0A72deyiMTi9PNWxZc7jy3DdxvWW4qepLr+N4rTWiLX5u1e02pnrpIzCNyLO6gMCTGBhU9qvfP57eWrEUYNXx/VYKZ+Ba2aaKRss5Bea0nc+/l3qlA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn; spf=pass smtp.mailfrom=seu.edu.cn; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b=JYCIQQEe; arc=none smtp.client-ip=45.254.49.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b="JYCIQQEe" Received: from LAPTOP-N070L597.localdomain (unknown [223.112.146.162]) by smtp.qiye.163.com (Hmail) with ESMTP id 32682fc73; Thu, 29 Jan 2026 16:35:16 +0800 (GMT+08:00) From: Zilin Guan To: alexander.deucher@amd.com Cc: christian.koenig@amd.com, airlied@gmail.com, simona@ffwll.ch, tao.zhou1@amd.com, Hawking.Zhang@amd.com, YiPeng.Chai@amd.com, ganglxie@amd.com, Stanley.Yang@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn, Zilin Guan Subject: [PATCH] drm/amdgpu: Fix memory leak in amdgpu_ras_init() Date: Thu, 29 Jan 2026 08:35:15 +0000 Message-Id: <20260129083515.886112-1-zilin@seu.edu.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-HM-Tid: 0a9c08e477e003a1kunm92e525c1109cdc X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkZHUxNVkNLS0weTh0YSk8eQ1YeHw5VEwETFhoSFy QUDg9ZV1kYEgtZQVlJSUhVSkpJVUpPTVVKTUlZV1kWGg8SFR0UWUFZT0tIVUpLSUhOQ0NVSktLVU tZBg++ DKIM-Signature: a=rsa-sha256; b=JYCIQQEeT13b0SzJAaVxu3/IOZNblgiFjNemjUkzGXSaHvOTvzGIqedotLFk7VPrGrBT3/tovOhpPIHnUuVp8SFZWr6UDzZiVtibggMP738+D01du7y8VYXozNew4aO4e1cPMBMdIDBhs9dQ7Y5IA5P+EPMQ+D4tANr1XLKdO/M=; s=default; c=relaxed/relaxed; d=seu.edu.cn; v=1; bh=nuTqOxVNmE8t2k0UNGPm5EmQmSMZzZtlqyG00Pd8Dfc=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" When amdgpu_nbio_ras_sw_init() fails in amdgpu_ras_init(), the function returns directly without freeing the allocated con structure, leading to a memory leak. Fix this by jumping to the release_con label to properly clean up the allocated memory before returning the error code. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: fdc94d3a8c88 ("drm/amdgpu: Rework pcie_bif ras sw_init") Signed-off-by: Zilin Guan --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_ras.c index 2a6cf7963dde..8de9f68f7bea 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -4343,7 +4343,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev) * to handle fatal error */ r =3D amdgpu_nbio_ras_sw_init(adev); if (r) - return r; + goto release_con; =20 if (adev->nbio.ras && adev->nbio.ras->init_ras_controller_interrupt) { --=20 2.34.1