Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3404872rwa; Tue, 23 Aug 2022 04:20:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR59ah490gs6ZtRypF5C091aPOStuabSoqK7lZl+OVyWOs3tsyx/3sTynNLd8uhJZy7WDcWW X-Received: by 2002:a05:6a02:115:b0:41c:4d5f:876 with SMTP id bg21-20020a056a02011500b0041c4d5f0876mr20776974pgb.419.1661253641323; Tue, 23 Aug 2022 04:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253641; cv=none; d=google.com; s=arc-20160816; b=ppHgmQMSjXB/vCxXbthpe/1m8EOFu/fiZkqyo54FXWtT62kWyW6bPr/o2KcFFS+ipO wAR83QNpZIeLFa1+o73w7iDBDpXqZHKC+vhdDef9TPtViafppYkBN2tIIfTIflT1psn/ B+ad4VfaC0jheLItWA5HkNf4CVr7Vb9S9kSIQsz935N2fKfFPcfGAIecEQcHsPDTjz/I IarhTVs4DAGgTDWNok+GFTf7yc3miF78lL1AA30nM4IRGQMLBcdwuKfD0YRejxmaQOK2 A5bIsIs0OT9VLYMd5a8e7qfavJj6SNGYTWnQJLK7yyQ+MdMMBL4My8U+Q+mtkp2S/lW9 XGJQ== 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=EhJxkRbI34YRrAD7PjRPw3mTVLInH+xQJoIxi6YwH4A=; b=w9JOztdbmfGxMaSA6r4Y3kd++WrYNcme0bFLxjxA1glFgwd5DyKvG/D9HrIa1SjVvx O3lulleiVyqwlpjXrywLS8mvsVy5666b6eePrEgCxYBHjLAUJLx/dot9TMYLhcfg2mvs pG6Txk0/UjHZv7Rm2aUWtABrBPrniiVTgrCAilJo+8l0EFcB4L/AuLvsnIL4TbGKUvHQ PXJEAo+NYoIq2AnSeUhkdzfZgdpoYIBigtzKZy6zLPznKtbMbJD1++7cxo7UqIvoWbhD Ou57mcvjoht6KUEFWPfm3KIUmC5OfE+HalKWVFYPeVfRiIfHBi8vplW1T+Sc7SjDuyIc kZFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q+orXx6T; 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 w3-20020a634903000000b0042ac7cd3c55si3784173pga.165.2022.08.23.04.20.30; Tue, 23 Aug 2022 04:20:41 -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=q+orXx6T; 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 S242203AbiHWJrN (ORCPT + 99 others); Tue, 23 Aug 2022 05:47:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352645AbiHWJlm (ORCPT ); Tue, 23 Aug 2022 05:41:42 -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 46F9699269; Tue, 23 Aug 2022 01:42:20 -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 E952A614E9; Tue, 23 Aug 2022 08:42:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B756C433D6; Tue, 23 Aug 2022 08:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244134; bh=3YWFN+XdT8fZR01BOiGHTKj+hLvtm2wKp6jWFyaFJ34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q+orXx6TQk0XQu3Zqn//M2qVPuoxoKvpX3CG7qJpUo8Newmr9P/U8o+ob508gWhoV P5rY8P0Sg6nXk8xXx73TmNlP2kyRzY7YJJuY/2u4k+TYOkthCBC0TX3QvwWDGQfkVH P2Rcys7qSSfB6cVU9m8JyT6W5+rO6ZUXw5t7zzek= 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.14 068/229] drm/rockchip: vop: Dont crash for invalid duplicate_state() Date: Tue, 23 Aug 2022 10:23:49 +0200 Message-Id: <20220823080056.147646905@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 80a65eaed0be..feb6a458f82d 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1068,6 +1068,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