Skip to contentSkip to conversation

drm/ttm: fix missing NULL check in the new page pool

PATCH In review Christian König 3 participants 3 messages Nov 6, 2020 – Nov 10, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: fix missing NULL check in the new page pool

The pool parameter can be NULL if we free through the shrinker.

---
 drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_pool.c +1 -1
index 44ec41aa78d6..1b96780b4989 100644
@@ -135,7 +135,7 @@ static void ttm_pool_free_page(struct ttm_pool *pool, enum ttm_caching caching,
 		set_pages_wb(p, 1 << order);
 #endif
 
-	if (!pool->use_dma_alloc) {
+	if (!pool || !pool->use_dma_alloc) {
 		__free_pages(p, order);
 		return;
 	}
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Christian König

The pool parameter can be NULL if we free through the shrinker.

Does this fix:
https://gitlab.freedesktop.org/drm/amd/-/issues/1362

Quoted 20 lines
---
 drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_pool.c +1 -2
index 44ec41aa78d6..1b96780b4989 100644
@@ -135,7 +135,7 @@ static void ttm_pool_free_page(struct ttm_pool *pool, enum ttm_caching caching,
                set_pages_wb(p, 1 << order);
 #endif
 
-       if (!pool->use_dma_alloc) {
+       if (!pool || !pool->use_dma_alloc) {
                __free_pages(p, order);
                return;
        }
--

2.25.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Tested-by Acked-by
#2 lore raw
Quoted 9 lines · Alex Deucher
Quoted 4 lines · Christian König

The pool parameter can be NULL if we free through the shrinker.

Does this fix:
https://gitlab.freedesktop.org/drm/amd/-/issues/1362

It does! So you can add my:

Thanks,
Martin

Quoted 25 lines
Quoted 20 lines
---
  drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_pool.c +1 -2
index 44ec41aa78d6..1b96780b4989 100644
@@ -135,7 +135,7 @@ static void ttm_pool_free_page(struct ttm_pool *pool, enum ttm_caching caching,
                 set_pages_wb(p, 1 << order);
  #endif
 
-       if (!pool->use_dma_alloc) {
+       if (!pool || !pool->use_dma_alloc) {
                 __free_pages(p, order);
                 return;
         }
--

2.25.1

Quoted 9 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel