AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.1 13/14] drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent
       [not found] <20240605120455.2967445-1-sashal@kernel.org>
@ 2024-06-05 12:04 ` Sasha Levin
  2024-06-18  9:11   ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2024-06-05 12:04 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jesse Zhang, Jesse Zhang, Christian König, Alex Deucher,
	Sasha Levin, Xinhui.Pan, airlied, daniel, Felix.Kuehling,
	shashank.sharma, guchun.chen, Philip.Yang, mukul.joshi,
	xiaogang.chen, amd-gfx, dri-devel

From: Jesse Zhang <jesse.zhang@amd.com>

[ Upstream commit a0cf36546cc24ae1c95d72253c7795d4d2fc77aa ]

The pointer parent may be NULLed by the function amdgpu_vm_pt_parent.
To make the code more robust, check the pointer parent.

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
index 69b3829bbe53f..370d02bdde862 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
@@ -754,11 +754,15 @@ int amdgpu_vm_pde_update(struct amdgpu_vm_update_params *params,
 			 struct amdgpu_vm_bo_base *entry)
 {
 	struct amdgpu_vm_bo_base *parent = amdgpu_vm_pt_parent(entry);
-	struct amdgpu_bo *bo = parent->bo, *pbo;
+	struct amdgpu_bo *bo, *pbo;
 	struct amdgpu_vm *vm = params->vm;
 	uint64_t pde, pt, flags;
 	unsigned int level;
 
+	if (WARN_ON(!parent))
+		return -EINVAL;
+
+	bo = parent->bo;
 	for (level = 0, pbo = bo->parent; pbo; ++level)
 		pbo = pbo->parent;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 6.1 13/14] drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent
  2024-06-05 12:04 ` [PATCH AUTOSEL 6.1 13/14] drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent Sasha Levin
@ 2024-06-18  9:11   ` Pavel Machek
  2024-06-18 11:42     ` Christian König
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2024-06-18  9:11 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Jesse Zhang, Christian König,
	Alex Deucher, Xinhui.Pan, airlied, daniel, Felix.Kuehling,
	shashank.sharma, guchun.chen, Philip.Yang, mukul.joshi,
	xiaogang.chen, amd-gfx, dri-devel

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

Hi!

> [ Upstream commit a0cf36546cc24ae1c95d72253c7795d4d2fc77aa ]
> 
> The pointer parent may be NULLed by the function amdgpu_vm_pt_parent.
> To make the code more robust, check the pointer parent.

If this can happen, it should not WARN().

If this can not happen, we don't need the patch in stable.

Best regards,
							Pavel
							
-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 6.1 13/14] drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent
  2024-06-18  9:11   ` Pavel Machek
@ 2024-06-18 11:42     ` Christian König
  2024-07-22 12:55       ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2024-06-18 11:42 UTC (permalink / raw)
  To: Pavel Machek, Sasha Levin
  Cc: linux-kernel, stable, Jesse Zhang, Alex Deucher, Xinhui.Pan,
	airlied, daniel, Felix.Kuehling, shashank.sharma, guchun.chen,
	Philip.Yang, mukul.joshi, xiaogang.chen, amd-gfx, dri-devel

Am 18.06.24 um 11:11 schrieb Pavel Machek:
> Hi!
>
>> [ Upstream commit a0cf36546cc24ae1c95d72253c7795d4d2fc77aa ]
>>
>> The pointer parent may be NULLed by the function amdgpu_vm_pt_parent.
>> To make the code more robust, check the pointer parent.
> If this can happen, it should not WARN().
>
> If this can not happen, we don't need the patch in stable.

Right, that patch shouldn't be backported in any way.

Regards,
Christian.

>
> Best regards,
> 							Pavel
> 							


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 6.1 13/14] drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent
  2024-06-18 11:42     ` Christian König
@ 2024-07-22 12:55       ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2024-07-22 12:55 UTC (permalink / raw)
  To: Christian König
  Cc: Pavel Machek, linux-kernel, stable, Jesse Zhang, Alex Deucher,
	Xinhui.Pan, airlied, daniel, Felix.Kuehling, shashank.sharma,
	guchun.chen, Philip.Yang, mukul.joshi, xiaogang.chen, amd-gfx,
	dri-devel

On Tue, Jun 18, 2024 at 01:42:56PM +0200, Christian König wrote:
>Am 18.06.24 um 11:11 schrieb Pavel Machek:
>>Hi!
>>
>>>[ Upstream commit a0cf36546cc24ae1c95d72253c7795d4d2fc77aa ]
>>>
>>>The pointer parent may be NULLed by the function amdgpu_vm_pt_parent.
>>>To make the code more robust, check the pointer parent.
>>If this can happen, it should not WARN().
>>
>>If this can not happen, we don't need the patch in stable.
>
>Right, that patch shouldn't be backported in any way.

I'll drop it, thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-22 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240605120455.2967445-1-sashal@kernel.org>
2024-06-05 12:04 ` [PATCH AUTOSEL 6.1 13/14] drm/amdgpu: fix dereference null return value for the function amdgpu_vm_pt_parent Sasha Levin
2024-06-18  9:11   ` Pavel Machek
2024-06-18 11:42     ` Christian König
2024-07-22 12:55       ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox