* [PATCH] drm/virtio: Fix possible memory allocation failure
@ 2026-08-18 11:32 Triet Hoang
2026-08-18 12:17 ` Triet Hoang
0 siblings, 1 reply; 2+ messages in thread
From: Triet Hoang @ 2026-08-18 11:32 UTC (permalink / raw)
To: dri-devel
Cc: virtualization, linux-kernel, airlied, kraxel, dmitry.osipenko,
gurchetansingh, olvaffe, maarten.lankhorst, mripard, tzimmermann,
simona, Triet Hoang
When kmem_cache_zalloc in virtio_gpu_get_vbuf fails, it will return
an error code. But none of its callers checks this error code, and
a core dump will take place.
Add __GFP_NOFAIL flag when calling kmem_cache_zalloc to make sure
it won't fail
Fixes: 6f3d9d0dd335 ("drm/virtio: Add drm_panic support")
Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index e5e1af8b8e8a..fdf0f3c2d3b7 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -93,7 +93,7 @@ virtio_gpu_panic_get_vbuf(struct virtio_gpu_device *vgdev, int size)
{
struct virtio_gpu_vbuffer *vbuf;
- vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_ATOMIC);
+ vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_ATOMIC | __GFP_NOFAIL);
vbuf->buf = (void *)vbuf + sizeof(*vbuf);
vbuf->size = size;
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/virtio: Fix possible memory allocation failure
2026-08-18 11:32 [PATCH] drm/virtio: Fix possible memory allocation failure Triet Hoang
@ 2026-08-18 12:17 ` Triet Hoang
0 siblings, 0 replies; 2+ messages in thread
From: Triet Hoang @ 2026-08-18 12:17 UTC (permalink / raw)
To: triet.hoang.dev
Cc: airlied, dmitry.osipenko, dri-devel, gurchetansingh, kraxel,
linux-kernel, maarten.lankhorst, mripard, olvaffe, simona,
tzimmermann, virtualization
This is a stupid idea. Sorry about that and just forget the PATCH.
Regards,
Triet
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-18 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 11:32 [PATCH] drm/virtio: Fix possible memory allocation failure Triet Hoang
2026-08-18 12:17 ` Triet Hoang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox