Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4328991pxb; Mon, 21 Feb 2022 18:07:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWbyI5/5UoJsXjB9Kv6I7RtDBU91MoP+PC9WT/W4C1GFyfBxy33n9AUOe8wiSpFoL4rI6t X-Received: by 2002:a17:90b:1054:b0:1bb:fc13:73ab with SMTP id gq20-20020a17090b105400b001bbfc1373abmr1724318pjb.241.1645495631068; Mon, 21 Feb 2022 18:07:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645495631; cv=none; d=google.com; s=arc-20160816; b=y42Tp6cN9fgExjqFLw7sVFd8xialwW4iHrUkrFmF0pkk1QyLUdCeMM12jp1fpQFXCJ WWn3UlzoCDXrpG1/ysqKkVS+3jyYcIHZuKPycCT49hWbalw1Xjniqub4hzrpsxPOIyjN N7SMNZKwoBEidmZbqkst+WwRjBu8UJtXkfi4pwhfOP5Zprv8YcqJbb78cxgRJsQpjlId sLJEElvm4XuUZX0gzJ9Pygf2Bnuxkdi+NLU1JQ27Z2TlyoQUN9rbrQNp6ay2rhvTwWhI 6GC9aorKhuh08oLi582arjHeCe+B8KsNPE9/o54Q1NL6CsMyFUYkTw7u9KTTA4cu8itu gDPw== 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=KrtBZBdoZT3xOaR/9ey8GIuAOIqToW9A5Pl/C0iWx3E=; b=vAw37BQqGz0PCqGrEyXrvWOIim825Lknfe53uESMm0QQjBCgmPP80jkcIExqfd2xH6 p95WIMdlIUL1yQuz/8GxpD+pUtEmspl7wvQHagtYHA/VvRMVNblQzq7OPBCxPoV16qYg sB+5eOIcsOcpaRmlgHm6634DzBj4e0/+WTaHPH/3Krngm+Ck69p9Q2hFG7MC4IkB7TFb NXG9B3F6a0rjWwVsTKNMr4QKFoqa1R/Ik5qmUBsXGClLWDosLht89LtiFVIBlqMaXKaa iRD6jXKdNDfB5CwxNvA59/SKClKoODfiASMxHT8dfu+ItnJL38ChZc4mOSQ7Vs4VglWs rwRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="V/kqUpcM"; 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 b11si31215681plh.37.2022.02.21.18.06.55; Mon, 21 Feb 2022 18:07:11 -0800 (PST) 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="V/kqUpcM"; 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 S1349943AbiBUJcH (ORCPT + 99 others); Mon, 21 Feb 2022 04:32:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350315AbiBUJWZ (ORCPT ); Mon, 21 Feb 2022 04:22:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19755381A8; Mon, 21 Feb 2022 01:09:52 -0800 (PST) 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 8F27E608C4; Mon, 21 Feb 2022 09:09:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DEA9C340E9; Mon, 21 Feb 2022 09:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645434592; bh=GD8jGo6Q+HJ1uMXDjuZtebM7kKMzIBsEqRPZY3MkF0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/kqUpcMi20UACvqF4aTPkk1Tr5+D4NWETF+ZHCwwNHQ7tpX/qv/82gQC570JwDya XFHd3ColZKwYoKgFXIznkJsCYrwxC5H2CKEBa7rEvXB0lbGShjhkVkYTeZsO5zaGDD K131+SfK96JxkFM4TjXrgrOAF7rF2V+LPnh2iZto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, fuyufan , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Maxime Ripard Subject: [PATCH 5.15 062/196] drm/atomic: Dont pollute crtc_state->mode_blob with error pointers Date: Mon, 21 Feb 2022 09:48:14 +0100 Message-Id: <20220221084933.007550158@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084930.872957717@linuxfoundation.org> References: <20220221084930.872957717@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=-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: Ville Syrjälä commit 439cf34c8e0a8a33d8c15a31be1b7423426bc765 upstream. Make sure we don't assign an error pointer to crtc_state->mode_blob as that will break all kinds of places that assume either NULL or a valid pointer (eg. drm_property_blob_put()). Cc: stable@vger.kernel.org Reported-by: fuyufan Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20220209091928.14766-1-ville.syrjala@linux.intel.com Acked-by: Maxime Ripard Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_atomic_uapi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -76,15 +76,17 @@ int drm_atomic_set_mode_for_crtc(struct state->mode_blob = NULL; if (mode) { + struct drm_property_blob *blob; + drm_mode_convert_to_umode(&umode, mode); - state->mode_blob = - drm_property_create_blob(state->crtc->dev, - sizeof(umode), - &umode); - if (IS_ERR(state->mode_blob)) - return PTR_ERR(state->mode_blob); + blob = drm_property_create_blob(crtc->dev, + sizeof(umode), &umode); + if (IS_ERR(blob)) + return PTR_ERR(blob); drm_mode_copy(&state->mode, mode); + + state->mode_blob = blob; state->enable = true; drm_dbg_atomic(crtc->dev, "Set [MODE:%s] for [CRTC:%d:%s] state %p\n",