From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C00CC4332F for ; Mon, 30 May 2022 13:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238450AbiE3NuN (ORCPT ); Mon, 30 May 2022 09:50:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238109AbiE3No1 (ORCPT ); Mon, 30 May 2022 09:44:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F4519BACA; Mon, 30 May 2022 06:32:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B809B80DBD; Mon, 30 May 2022 13:32:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AEFCC3411E; Mon, 30 May 2022 13:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653917541; bh=Aoq/ZnXVcKk+p7VdfH7dk2D2Y56VczJQo9MgI9eHjA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJpCDAqWALErbC+IEm3tQSNuWIX9xJ3b+DDvAcHPcakxf9mIdXN0BjZRHncm4Nvc6 nxoa/YyNBTYFJ0v7JmGa17KcTYPJMyCDoHbJDTOKprWEqFRyOwsnhOHYs/wdYBdFsW rMNsACl+bU6Ebcg6JKYlOMuDTBMkdGu1vBb+7KYy5unJKCBmke/lE1xyguYvV/kakI z39aVLRYAkDPXMP4oMV0opBCRWngSdBJK4YZrJW7giqGC44Jav6SNKpEln98brXQBc EEbCE8ISSH+YJzfHaGVFIlw/jHJEIJh4uAxwAkFUEZ7hSQ4XxPu91kvgQ4P0+P4XHW OE+AZgy3xXBBA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Liviu Dudau , Steven Price , Sasha Levin , james.qian.wang@arm.com, mihail.atanassov@arm.com, brian.starkey@arm.com, airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.17 018/135] drm/komeda: return early if drm_universal_plane_init() fails. Date: Mon, 30 May 2022 09:29:36 -0400 Message-Id: <20220530133133.1931716-18-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220530133133.1931716-1-sashal@kernel.org> References: <20220530133133.1931716-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liviu Dudau [ Upstream commit c8f76c37cc3668ee45e081e76a15f24a352ebbdd ] 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 Signed-off-by: Sasha Levin --- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index d63d83800a8a..d646e3ae1a23 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -275,8 +275,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); -- 2.35.1