From: jsg Date: Tue, 28 Mar 2023 04:11:29 +0000 (+0000) Subject: drm/ttm: Fix a NULL pointer dereference X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=52e4ee52ec2a73e19336239e3e9f82673d734dd7;p=openbsd drm/ttm: Fix a NULL pointer dereference From Thomas Hellstrom 9ba1720f6c4a0f13c3f3cb5c28132ee75555d04f in linux-6.1.y/6.1.21 9a9a8fe26751334b7739193a94eba741073b8a55 in mainline linux --- 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);