drm/vkms: Fix plane duplicate_state
diff mbox series

Message ID 20181128101033.4840-1-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • drm/vkms: Fix plane duplicate_state
Related show

Commit Message

Daniel Vetter Nov. 28, 2018, 10:10 a.m. UTC
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: syzbot+eb6e5365f23c02517dda@syzkaller.appspotmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/gpu/drm/vkms/vkms_plane.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Eric Anholt Nov. 28, 2018, 9:48 p.m. UTC | #1
Daniel Vetter <daniel.vetter@ffwll.ch> writes:

> 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.
Daniel Vetter Nov. 29, 2018, 9:30 a.m. UTC | #2
On Wed, Nov 28, 2018 at 01:48:53PM -0800, Eric Anholt wrote:
> Daniel Vetter <daniel.vetter@ffwll.ch> writes:
> 
> > 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

Patch
diff mbox series

diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 7041007396ae..e3bcea4b4891 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -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;