Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2110827iof; Tue, 7 Jun 2022 20:05:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRlJhw1x59vgEcfyREOUmyoQ7gFZEEh9qt9MSJBxx1+yD47HM5LK1ANrSHzKNmQW3CkcyU X-Received: by 2002:a05:6a00:84b:b0:51c:21e3:b542 with SMTP id q11-20020a056a00084b00b0051c21e3b542mr12120111pfk.31.1654657541271; Tue, 07 Jun 2022 20:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654657541; cv=none; d=google.com; s=arc-20160816; b=kM3xVylfmWhzFJS4nsFO8N7V5WnmUiqOnTQfrVq9Ycgj06EawMNY4lR75KQo8r7P4G VfsDcakVsnY67BhFUQ7hTDdVt1Mwm9fb8L2x4XiwVF8jjuEruOhw4n7YZfTOCw2rOn8c PXjFNBh95emY5dNI1+GndAbgoo8tCduxHBjhIA3o4u1KHdT9unsKH60zmaSoYfM3rDkO gSvALrFnewvMn5lDmWvKBuur4jGpgt6AWXei/OJCNTOt7x8t6tkwham9QMHGai8C3zjM B/vc7JqFAUamaTw2uPwvXOedLaSvfxj4HZzaCw2ow1AApri+MpKKvPWcc3Hm9CR4Jh2q ORzQ== 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=OxKCOPgwQOQBQeee4lYo27EOw0t6SJMamM9W+keUYgY=; b=U505NpN3B7qGeHPIUf5nyG/xx7GEAegGuuBbirxYz9QXnwRnFY+Skcm7etft8k1P2A uiLQ8CXDj4//RQROT/hPrQjK1oJGfumCg2HHbfMAc3sCDali9/JwSrZUkXasxHlpfYLL 74orAXrLmNVXXdtwglsOu3KrQo1ZL4KxGbHKsCn3m9zYBfZ8xWD8rO/krnB6ltdyP8CA xFCKooUiNa65KR3uP/arbDWFpmfJBz0ga+6e/Xl7NaDQMINg9sBLzsnOI/X647EAog44 sK7p5S2B8Azv1fAhoFcMAM+fq49MngVyFxGdw//uLme7KAUxK2sBtmjxHK/Vks0lhE13 BXmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VNC3nVrU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t9-20020a634449000000b003daf6356570si26542772pgk.3.2022.06.07.20.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:05:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VNC3nVrU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E90F1D105E; Tue, 7 Jun 2022 19:12:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382704AbiFGWHL (ORCPT + 99 others); Tue, 7 Jun 2022 18:07:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378735AbiFGVEb (ORCPT ); Tue, 7 Jun 2022 17:04:31 -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 252E818CE18; Tue, 7 Jun 2022 11:48:58 -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 B8DACB8220B; Tue, 7 Jun 2022 18:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2149CC385A2; Tue, 7 Jun 2022 18:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627735; bh=Aoq/ZnXVcKk+p7VdfH7dk2D2Y56VczJQo9MgI9eHjA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNC3nVrUzn4nEr8DfhDa+WJ9o/6ul5g1h32KaHNtiQ2ONcNnBqoEbdDv8OvXXsHS9 kF4rfx6yJs3z4/UsYnRgTv6QaDJlZdBdfsqFN5gdb7WbQK9VAi5kL1rdk+PylWd7eW Cpfjiw22AXp71ylrGfxr9yWq6zcaJWyeuUIM31Ic= 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.18 075/879] drm/komeda: return early if drm_universal_plane_init() fails. Date: Tue, 7 Jun 2022 18:53:13 +0200 Message-Id: <20220607165004.868468353@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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