Patch "drm/amdgpu: Fix size validation for non-exclusive domains (v4)" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/amdgpu: Fix size validation for non-exclusive domains (v4)

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amdgpu-fix-size-validation-for-non-exclusive-dom.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ef451fff619412a1d8467456e5ed469e21d46c48
Author: Luben Tuikov <luben.tuikov@xxxxxxx>
Date:   Sat Dec 10 02:51:19 2022 -0500

    drm/amdgpu: Fix size validation for non-exclusive domains (v4)
    
    [ Upstream commit 7554886daa31eacc8e7fac9e15bbce67d10b8f1f ]
    
    Fix amdgpu_bo_validate_size() to check whether the TTM domain manager for the
    requested memory exists, else we get a kernel oops when dereferencing "man".
    
    v2: Make the patch standalone, i.e. not dependent on local patches.
    v3: Preserve old behaviour and just check that the manager pointer is not
        NULL.
    v4: Complain if GTT domain requested and it is uninitialized--most likely a
        bug.
    
    Cc: Alex Deucher <Alexander.Deucher@xxxxxxx>
    Cc: Christian König <christian.koenig@xxxxxxx>
    Cc: AMD Graphics <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Luben Tuikov <luben.tuikov@xxxxxxx>
    Reviewed-by: Christian König <christian.koenig@xxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 3df13d841e4d..3be3cba3a16d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -446,27 +446,24 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
 
 	/*
 	 * If GTT is part of requested domains the check must succeed to
-	 * allow fall back to GTT
+	 * allow fall back to GTT.
 	 */
 	if (domain & AMDGPU_GEM_DOMAIN_GTT) {
 		man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
 
-		if (size < man->size)
+		if (man && size < man->size)
 			return true;
-		else
-			goto fail;
-	}
-
-	if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
+		else if (!man)
+			WARN_ON_ONCE("GTT domain requested but GTT mem manager uninitialized");
+		goto fail;
+	} else if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
 		man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
 
-		if (size < man->size)
+		if (man && size < man->size)
 			return true;
-		else
-			goto fail;
+		goto fail;
 	}
 
-
 	/* TODO add more domains checks, such as AMDGPU_GEM_DOMAIN_CPU */
 	return true;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux