Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2929745rwb; Mon, 15 Aug 2022 14:15:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dA1GeKdQJrDVG70crlEvWwJqGhWKHTm9FxafsmUnU+3xw4NcWuxfhqfJERynIWxFKt6zB X-Received: by 2002:a17:906:8441:b0:730:7bd1:17ca with SMTP id e1-20020a170906844100b007307bd117camr11784146ejy.229.1660598132789; Mon, 15 Aug 2022 14:15:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598132; cv=none; d=google.com; s=arc-20160816; b=Hh8Xc7iw7OdDkS9/XJe2j2j5LtxVd+C1JtowSg2VDNaRGCKLyDbwTSutnf2BhDCGhT D87TAdwLe4TtzZASP6OP8b5Fb9cu7oPv//gVj0+71Dw5jdMpWXW/Zok8KL8nZC+oSfhW mndCjSEX2qb1uYyQyfClxMxNLmkbFFClRx0H762mexsy5HsuFIUokOCDXA42YNYe0hn+ S/iVBitmZYRLp+mEbYhUN3rp4DtJ9M6CjCxMRVpQ+Psm/a6/UY2gtYvvUCLb4JYZawNi a9oOYeuIizN2wxO9q3PX+Z0A5mjypL30coGCyb7Cm44QQz9UBPxa+fRmjgvhJ7FIsO12 TSnw== 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=xyWq078bii15Q0mq/g+MGtPy4/kNuNPOetmAbjSc+0k=; b=aeGc2JC0KQkBmJNBJRE1Qu+jKbMcIsNvVn9IPUzvCZyuqAP/gRBwxYtg29S9cEJGAU s58J5U5PJJk63GvfGOvX305wNwYtouSzGG9KwPLZa/GR788OlyEw/x744g4KIx5Hp4AR B9fsRRDaZmKw9dX9tP/XUbe6Nai+tiRF64jbqzD1raGxKD0216RSzgSDEhW7RNvwIKP7 qr7Nm4txmFdPNDfbB/+ZAg1aYxlinDXLt+OzcTx7t25UmQm33VTqj39EyqPld70EJAXd OQ5U7ewPxznQgqR0Gp9GKMynx/OivMVzsm8HYXzFwQgYIygGo80Xe3wbZdYfTHE3kmA/ 2Tzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DdyxxYlt; 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 a11-20020a509e8b000000b0043d0a1ec60bsi6989766edf.393.2022.08.15.14.15.05; Mon, 15 Aug 2022 14:15:32 -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=DdyxxYlt; 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 S241029AbiHOVKS (ORCPT + 99 others); Mon, 15 Aug 2022 17:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343703AbiHOVFp (ORCPT ); Mon, 15 Aug 2022 17:05:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9369D59AD; Mon, 15 Aug 2022 12:15:07 -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 5491BB810C6; Mon, 15 Aug 2022 19:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7685DC433D7; Mon, 15 Aug 2022 19:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590904; bh=FxBN7LaxHEX1si3N7YKQqHSv/xxhqf4UY3m1TLZKvMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DdyxxYlt0XdlbaAPAvF8A7fqIbmhgt09X3dj4G6WGoFjA+lVSzD6oBvdEJyvoGq38 lLtDtgzFRPvA+6OgFAbI+LPpZb89zb8rfIGkf+mUb+1qIDSxgN6sS69XdffW5lGp9x gngSFcWsPWI34weyxZQyHSP+u4/ic1e7Ub2Uz/Zs= 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 5.18 0409/1095] drm/rockchip: vop: Dont crash for invalid duplicate_state() Date: Mon, 15 Aug 2022 19:56:48 +0200 Message-Id: <20220815180446.629620476@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 d53037531f40..26e24f62f75f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1552,6 +1552,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