Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp446242iog; Mon, 13 Jun 2022 06:08:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZYf0CQKO4g1KAldPvPKYehEryi4WhS6E2GM8utMa6mw+zloRadAitBhD3aCeBvJpXDdEJ X-Received: by 2002:a17:902:b689:b0:167:8b69:d1a7 with SMTP id c9-20020a170902b68900b001678b69d1a7mr35525707pls.156.1655125653242; Mon, 13 Jun 2022 06:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125653; cv=none; d=google.com; s=arc-20160816; b=E3rwedD5lckoanL95/yXsLm3qlG/MjkM2i5ilWngbzWKz5Ze1yCUJ2rLdwhuIOiYvv 3zUOPbzgnHADIfD6cFEL4QnVBYqPXHKbVXkqbYE25du+lzVe9uzptxW+bsNRnDgg6JeY UdQ+GgIIetVPYoJ+dXoR6T7GGuT/J+eO/47vadIDxj0X0FKmQgcokbacTCp4JuP1UwD7 07Ra8hGuGLFIwH9LtR9eV9/T0bqBl32t+PTOnJ20aIm6GCibMDeMoBSFrFr6ZVE6XUzY dM4yL4wrxSPiCZ05e6IszwWrPENTNmX3DAAEfULMJeA2hzROfO2WtyD3OmSshNEwb6y8 ZQdA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OQ1KuKQbBCBDDXOw46bcs66gklTAas+/IinRwBt64bw=; b=YIzN8MLlTZDxx+c6+OLCYDWPKMtG5B+xnuCttl/JfN4ufZPG0MwozIZOTUeTRV0Fwj fDT2R2B+Uq6qmErGhPEWe4KQiBQgg0ktlPjRK0CxJumoHU9Nb2KjT/EmpdISPIq1fixU h9wiYjwxxybwesHUKQfnbNr+RyVlW4iWZhjafejxCD+u1XkbgXZ4nqEBD5cd3ZTTuM95 1E+EQmoRLJSSuFhOsSlT6vix0bIyPHgRGvfLqzqBRAv07HAy7mDwqw99STjTavhUX78Z 3TXK9regkxYVBnxrwV09EL5QgZ68UfF1E1DM4ItLy2d/D4HuyoU9ni8crC38xBXVW6Iu mgIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wjaiGTj6; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 124-20020a630182000000b003fa63cec349si9407551pgb.832.2022.06.13.06.07.19; Mon, 13 Jun 2022 06:07:33 -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=@linuxfoundation.org header.s=korg header.b=wjaiGTj6; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347724AbiFMK46 (ORCPT + 99 others); Mon, 13 Jun 2022 06:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349476AbiFMKyV (ORCPT ); Mon, 13 Jun 2022 06:54:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CB6C2494F; Mon, 13 Jun 2022 03:28:08 -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 1C589B80E93; Mon, 13 Jun 2022 10:28:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CCCEC34114; Mon, 13 Jun 2022 10:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116085; bh=2LFwGuCsKCuYENEjOsRcLSDeb9bv9mIq1XjW2w4MUhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjaiGTj6aFN9D3ELdcsFARK3g0OW4TdApkXVs5bKwxMLfazIVzAiA43Q///6JmVVR 7ESL4fgAGVdEfEkl/GtMXCSf/7Z8clPYFoD1JA3lB3pnnUqQ2WrjhuRekEoHDmMmPf I7NrjG+E7gr8w8KRLFC/uxaTkh9YU+DouYTsmjRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Price , Liviu Dudau , Sasha Levin Subject: [PATCH 5.4 020/411] drm/komeda: return early if drm_universal_plane_init() fails. Date: Mon, 13 Jun 2022 12:04:53 +0200 Message-Id: <20220613094929.107319038@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 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