Patch "nouveau/svm: fix missing folio unlock + put after make_device_exclusive_range()" has been added to the 6.13-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

    nouveau/svm: fix missing folio unlock + put after make_device_exclusive_range()

to the 6.13-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:
     nouveau-svm-fix-missing-folio-unlock-put-after-make_.patch
and it can be found in the queue-6.13 subdirectory.

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



commit 52caec2fcb742f8e1c68d554962faaa718d025a1
Author: David Hildenbrand <david@xxxxxxxxxx>
Date:   Fri Jan 24 19:15:23 2025 +0100

    nouveau/svm: fix missing folio unlock + put after make_device_exclusive_range()
    
    [ Upstream commit b3fefbb30a1691533cb905006b69b2a474660744 ]
    
    In case we have to retry the loop, we are missing to unlock+put the
    folio. In that case, we will keep failing make_device_exclusive_range()
    because we cannot grab the folio lock, and even return from the function
    with the folio locked and referenced, effectively never succeeding the
    make_device_exclusive_range().
    
    While at it, convert the other unlock+put to use a folio as well.
    
    This was found by code inspection.
    
    Fixes: 8f187163eb89 ("nouveau/svm: implement atomic SVM access")
    Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
    Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>
    Tested-by: Alistair Popple <apopple@xxxxxxxxxx>
    Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250124181524.3584236-2-david@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
index b4da82ddbb6b2..8ea98f06d39af 100644
--- a/drivers/gpu/drm/nouveau/nouveau_svm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
@@ -590,6 +590,7 @@ static int nouveau_atomic_range_fault(struct nouveau_svmm *svmm,
 	unsigned long timeout =
 		jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
 	struct mm_struct *mm = svmm->notifier.mm;
+	struct folio *folio;
 	struct page *page;
 	unsigned long start = args->p.addr;
 	unsigned long notifier_seq;
@@ -616,12 +617,16 @@ static int nouveau_atomic_range_fault(struct nouveau_svmm *svmm,
 			ret = -EINVAL;
 			goto out;
 		}
+		folio = page_folio(page);
 
 		mutex_lock(&svmm->mutex);
 		if (!mmu_interval_read_retry(&notifier->notifier,
 					     notifier_seq))
 			break;
 		mutex_unlock(&svmm->mutex);
+
+		folio_unlock(folio);
+		folio_put(folio);
 	}
 
 	/* Map the page on the GPU. */
@@ -637,8 +642,8 @@ static int nouveau_atomic_range_fault(struct nouveau_svmm *svmm,
 	ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, size, NULL);
 	mutex_unlock(&svmm->mutex);
 
-	unlock_page(page);
-	put_page(page);
+	folio_unlock(folio);
+	folio_put(folio);
 
 out:
 	mmu_interval_notifier_remove(&notifier->notifier);




[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