Skip to contentSkip to conversation

drm/virtio: add null check in virtio_gpu_poll

PATCH In review Gurchetan Singh 1 participant 2 messages Nov 15, 2021

Subsystems (3)
lore
Share & tools
lore

Gurchetan Singh

author reviewer
#0 lore raw

PATCH 1/1 drm/virtio: add null check in virtio_gpu_poll

From: Gurchetan Singh <[email protected]>

If vfpriv is null, we shouldn't check vfpriv->ring_idx_mask.

---
 drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_drv.c +1 -1
index 749db18dcfa2..7975ea06b316 100644
@@ -166,7 +166,7 @@ static __poll_t virtio_gpu_poll(struct file *filp,
 	struct drm_pending_event *e = NULL;
 	__poll_t mask = 0;
 
-	if (!vfpriv->ring_idx_mask)
+	if (!vfpriv || !vfpriv->ring_idx_mask)
 		return drm_poll(filp, wait);
 
 	poll_wait(filp, &drm_file->event_wait, wait);
Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
author reviewer
#1 lore raw
Quoted 16 lines · Gurchetan Singh

From: Gurchetan Singh <[email protected]>

If vfpriv is null, we shouldn't check vfpriv->ring_idx_mask.

---
 drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_drv.c +0 -0
index 749db18dcfa2..7975ea06b316 100644

drivers/gpu/drm/virtio/virtgpu_drv.c static __poll_t virtio_gpu_poll(struct file *filp, · line 172

Quoted 8 lines
drivers/gpu/drm/virtio/virtgpu_drv.c +1 -1
@@ -166,7 +166,7 @@ static __poll_t virtio_gpu_poll(struct file *filp,
        struct drm_pending_event *e = NULL;
        __poll_t mask = 0;
 
-       if (!vfpriv->ring_idx_mask)
+       if (!vfpriv || !vfpriv->ring_idx_mask)
                return drm_poll(filp, wait);
 
        poll_wait(filp, &drm_file->event_wait, wait);

Nevermind, looks like fix was merged in the main tree and will make it back to to drm-misc-next:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d89c0c8322ecdc9a2ec84b959b6f766be082da76

Quoted 3 lines

2.34.0.rc1.387.gb447b232ab-goog