From: Liviu Dudau Date: Thu, 2 Dec 2021 17:00:33 +0000 (+0000) Subject: drm/komeda: return early if drm_universal_plane_init() fails. X-Git-Tag: for-5.19/block-exec-2022-06-02~43^2~19^2~57 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=c8f76c37cc3668ee45e081e76a15f24a352ebbdd;p=linux-2.6-block.git drm/komeda: return early if drm_universal_plane_init() fails. If drm_universal_plane_init() fails early we jump to the common cleanup code that calls komeda_plane_destroy() which in turn could access the uninitalised drm_plane and crash. Return early if an error is detected without going through the common code. Reported-by: Steven Price Reviewed-by: Steven Price Signed-off-by: Liviu Dudau Link: https://lore.kernel.org/dri-devel/20211203100946.2706922-1-liviu.dudau@arm.com --- diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index 9a8197a23c45..e0b9f7063b20 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -270,8 +270,10 @@ static int komeda_plane_add(struct komeda_kms_dev *kms, komeda_put_fourcc_list(formats); - if (err) - goto cleanup; + if (err) { + kfree(kplane); + return err; + } drm_plane_helper_add(plane, &komeda_plane_helper_funcs);