Skip to contentSkip to conversation

drm/vkms: Fix plane duplicate_state

PATCH In review Daniel Vetter 3 participants 3 messages Nov 28, 2018 – Nov 29, 2018

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

PATCH 1/1 drm/vkms: Fix plane duplicate_state

We need to handle allocation failures and bail out. While at it, tune the allocation failures down to debug level.

syzbot injected an allocation failure and then hit this WARN_ON.

Reported-by [email protected]
Cc Haneen Mohammed <[email protected]>
Cc Sean Paul <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Gustavo Padovan <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_plane.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/vkms_plane.c +5 -2
index 7041007396ae..e3bcea4b4891 100644
@@ -23,8 +23,11 @@ vkms_plane_duplicate_state(struct drm_plane *plane)
 		return NULL;
 
 	crc_data = kzalloc(sizeof(*crc_data), GFP_KERNEL);
-	if (WARN_ON(!crc_data))
-		DRM_INFO("Couldn't allocate crc_data");
+	if (!crc_data) {
+		DRM_DEBUG_KMS("Couldn't allocate crc_data\n");
+		kfree(vkms_state);
+		return NULL;
+	}
 
 	vkms_state->crc_data = crc_data;
 
Signature · 6 lines
2.19.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 4 lines · Daniel Vetter

We need to handle allocation failures and bail out. While at it, tune the allocation failures down to debug level.

syzbot injected an allocation failure and then hit this WARN_ON.

r-b.

I also often don't add kmalloc failure messages, since it's rare and spits a warning anyway.

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

#2 lore raw
Quoted 11 lines · Eric Anholt
Quoted 4 lines · Daniel Vetter

We need to handle allocation failures and bail out. While at it, tune the allocation failures down to debug level.

syzbot injected an allocation failure and then hit this WARN_ON.

r-b.

I also often don't add kmalloc failure messages, since it's rare and spits a warning anyway.

Yeah, just figured I keep it since it's there. Thanks for the review, pushed.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel