Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3841211ioo; Mon, 30 May 2022 10:52:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVRg2njyWZ9DjEELJaqPfcsQnBOaC9yBzf0d1hc3/wE4SsVmgzOZtH8L2HnWj5S60d6sb0 X-Received: by 2002:a17:907:3e96:b0:6fe:b339:2e39 with SMTP id hs22-20020a1709073e9600b006feb3392e39mr42574423ejc.271.1653933147705; Mon, 30 May 2022 10:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653933147; cv=none; d=google.com; s=arc-20160816; b=rsZ8gdcidFG1Z/wBzaGU4NcPvDpkvHwFpWZZHlUKsbTjCUBvPjcN8kOqhyYdVhT/pl jDSmF4l4T2ga4ORihbuSAifhMkjc/zCohO8FTOkzoM020g4ZFq/VzGn659FIhmCaeBvx B3cpDe8Hru8fRSpyHajhNbUSXtpE0c53EA8rgl8Z5jnDqpEwfN/u5RZVjs+P8gZulHuD zo7/8pYNIYN9y5OK1lZ5yCW5ng8VvlkROknIU4Dg/0HRD6KnZw6r7NF+pxmmPTWtGAIh 5AQDtmws8HbNg/BLnzQnuuH1UD9E3R7pJcFeOkknFVbHYg0mU1XyUeP7SmdX9xczL5kD 61Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OQ1KuKQbBCBDDXOw46bcs66gklTAas+/IinRwBt64bw=; b=psfOoIvAesuxEMFb4bqvwvqvbbHPT75Tf6KC/3LuBjOSylFvAQdaLQkJzKjMi8nPGJ +CI1Ino4dKpQIO3T6+7dWa77kOJVXoZumYuRqnQwEKh/bfIRjkzbh0zHswHVkhAhlssi 3pyJWC77ww8jc/hLfncsfUmb9Z6wPaUqi5VNQsbglMIGcA44G9KcH9mAU5KO51d2NzXl hxFHJco5nTXXQ9/eRam/mc+qrw0mnXADaNhWYZj16RPd2Kt9Pe+0uptQ3oyVb6eVrRnS WypLbrzwcMszeLPT+S2lxhOfMvBuHjUSXjlYNUa3Fmq7OtgLCLxIDqIRrpiKyB2HzCiC EzAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EYMvK4ED; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb41-20020a1709071ca900b006fee28c47a7si11339346ejc.9.2022.05.30.10.52.01; Mon, 30 May 2022 10:52:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EYMvK4ED; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241765AbiE3OgR (ORCPT + 99 others); Mon, 30 May 2022 10:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241465AbiE3ORh (ORCPT ); Mon, 30 May 2022 10:17:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CDC252B35; Mon, 30 May 2022 06:47:27 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A034B60F47; Mon, 30 May 2022 13:47:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB56DC341C0; Mon, 30 May 2022 13:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653918446; bh=2LFwGuCsKCuYENEjOsRcLSDeb9bv9mIq1XjW2w4MUhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EYMvK4EDMMxf23l2zSA1Zf1xrgqnd8EN/G7c8WRZuTPLus9dA4pMtDFbsx6zsKS+K 038LCmXes4nxSQIoOuls9WsSiq0WMeNLANEioeUmI9sEsYUE7sA8MBV5eXhbn6/jOX nb0p+aqdEJPd87I79FEZgxVPjgy0h740STqwZqulV8ZkM6ePOnRneXI/M71WNc+PbI WpMGcZ4dsxTijiCjGX40/g706/Ol9kP63YGKp379VvsnxDdBrLVRYdrVpVT2lllkJX WhBR7KZSpHZTgWKNvTYfXN32E26jS41u0p4SC1j0KwBO7AUJgC9gmXPgUQC/phN9Qx yZTIXXUISdc3A== 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.4 09/55] drm/komeda: return early if drm_universal_plane_init() fails. Date: Mon, 30 May 2022 09:46:15 -0400 Message-Id: <20220530134701.1935933-9-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220530134701.1935933-1-sashal@kernel.org> References: <20220530134701.1935933-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 98e915e325dd..a5f57b38d193 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -274,8 +274,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