Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3404506rwa; Tue, 23 Aug 2022 04:20:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR4BRWS90ABt1vjZUbStNgNQcZ5x2yPNsDyGTLFKbOzuk9G0vNKKZhmyYCOxDGlpEYLgq7Jm X-Received: by 2002:a17:90a:6b4c:b0:1fa:d973:e4eb with SMTP id x12-20020a17090a6b4c00b001fad973e4ebmr2775426pjl.15.1661253619441; Tue, 23 Aug 2022 04:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253619; cv=none; d=google.com; s=arc-20160816; b=GNPogywLp6RHVKZRJoZoeu4Og0PhfrPBkZGjRIUKJf0pcH2fitgE/Sp1O5fg0NkHe/ IKHdhbcL/Zei4yK2dcCGdgH6nTq/q8eBsMroud1pd4VjtO7GvT+BG67SqDfEqaT7JxOW hS1bDKNFF/0rmGRc9p1odqhe79ERvi2qEkIaPSiOvY/51tshjns2OPPUgZKM37SthcZl RGGfPNWSHM975ZeTG+4/cD9hehOIf9/eLkMcbF30ueLwiMtvy8CzcZgbyIJ4+dgVuqJk t1pyMFqkuF2H4XVz596wwRGrnhCS2z6rkGpY6DGp14EO/+Y8kQKqo8ON8zrRZUwsbS6Z eyiA== 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=s76Dq2RIJywV5yECRP48LAs6JDePSF257Z2ehMVolPQ=; b=pLfaTrsD+eiCQDCXIs94nrTVGEG0pemyJcdVcnbUKg+sy05X5eb1w+jO122HaLpZYt eiJyZXTpIgolTXtvrJkuWlBXhYiU4mJWMiq7n/5kxYsq0D2k5k3/cfyWwW9vTj4I4oiV xd3UlGslMd5Ik9KKZlfeHBqIuJW5K+z2WaQvJjRqiufCB0IPc5Ty54FuJNfRyPahtmmB OqrNKpnxQliyzhyzE4qyDaB2P7aUh6PiPr2TkXTA5ZdyQh53YCMnodRMVjSmAY/rXuC7 4S/a1Dw4mfsvm2x6AXCqaRAa5ZZMI7E36qhns6xuEdQyDrKp4Rl92MPgBg80QGmOIkBS UZxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aPMaNvA8; 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 z9-20020a63d009000000b00429cf28b83dsi15258182pgf.396.2022.08.23.04.20.07; Tue, 23 Aug 2022 04:20:19 -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=aPMaNvA8; 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 S1355476AbiHWKiu (ORCPT + 99 others); Tue, 23 Aug 2022 06:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355068AbiHWKWs (ORCPT ); Tue, 23 Aug 2022 06:22:48 -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 044856557C; Tue, 23 Aug 2022 02:03:59 -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 EA54D61580; Tue, 23 Aug 2022 09:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56D44C433C1; Tue, 23 Aug 2022 09:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245438; bh=6/MHLeXqUauKyeVG4fRouCvaERxk+khbFOYsTzPj+qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aPMaNvA8R3s8m/+OkBKTzzQBEor40CKWvNGYXvWE/381uRcc8Yl2yv7VrrJ1vCgNs ze5X9eeVc9XY5bOgbTphf2cpTrv/6qvpw0/mWmJYVGPVYyRZgzN390xZSPDlSFUkhs gXqyUZvbgWtg7Y8T9lR7WDyodJDAp+NzBmEzX2u4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sean Paul , Douglas Anderson , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.19 079/287] drm/rockchip: vop: Dont crash for invalid duplicate_state() Date: Tue, 23 Aug 2022 10:24:08 +0200 Message-Id: <20220823080102.922291150@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Brian Norris [ Upstream commit 1449110b0dade8b638d2c17ab7c5b0ff696bfccb ] It's possible for users to try to duplicate the CRTC state even when the state doesn't exist. drm_atomic_helper_crtc_duplicate_state() (and other users of __drm_atomic_helper_crtc_duplicate_state()) already guard this with a WARN_ON() instead of crashing, so let's do that here too. Fixes: 4e257d9eee23 ("drm/rockchip: get rid of rockchip_drm_crtc_mode_config") Signed-off-by: Brian Norris Reviewed-by: Sean Paul Reviewed-by: Douglas Anderson Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20220617172623.1.I62db228170b1559ada60b8d3e1637e1688424926@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index c0b647435974..69eb0de9973f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1088,6 +1088,9 @@ static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc) { struct rockchip_crtc_state *rockchip_state; + if (WARN_ON(!crtc->state)) + return NULL; + rockchip_state = kzalloc(sizeof(*rockchip_state), GFP_KERNEL); if (!rockchip_state) return NULL; -- 2.35.1