From: Daniel Vetter Date: Wed, 28 Nov 2018 10:10:33 +0000 (+0100) Subject: drm/vkms: Fix plane duplicate_state X-Git-Tag: v5.0-rc1~185^2~5^2~31 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=7cdf33ab02e01300e7e6289acbac9cd8759f8712;p=linux.git 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: syzbot+eb6e5365f23c02517dda@syzkaller.appspotmail.com Signed-off-by: Daniel Vetter Cc: Haneen Mohammed Cc: Sean Paul Cc: Daniel Vetter Cc: Rodrigo Siqueira Cc: Gustavo Padovan Reviewed-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/20181128101033.4840-1-daniel.vetter@ffwll.ch --- 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;