From 52e4ee52ec2a73e19336239e3e9f82673d734dd7 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 28 Mar 2023 04:11:29 +0000 Subject: [PATCH] drm/ttm: Fix a NULL pointer dereference From Thomas Hellstrom 9ba1720f6c4a0f13c3f3cb5c28132ee75555d04f in linux-6.1.y/6.1.21 9a9a8fe26751334b7739193a94eba741073b8a55 in mainline linux --- sys/dev/pci/drm/ttm/ttm_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/ttm/ttm_device.c b/sys/dev/pci/drm/ttm/ttm_device.c index c3dfc192e4a..d4ad7edf700 100644 --- a/sys/dev/pci/drm/ttm/ttm_device.c +++ b/sys/dev/pci/drm/ttm/ttm_device.c @@ -154,7 +154,7 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx, struct ttm_buffer_object *bo = res->bo; uint32_t num_pages; - if (!bo) + if (!bo || bo->resource != res) continue; num_pages = PFN_UP(bo->base.size); -- 2.20.1