Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3944628pxb; Mon, 21 Feb 2022 08:49:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzI0FYmCEfwqqm1NNd2CsWp4wfCKynzYxXkT4BVZzgGYpKzSweCQZSf1GhYyzWr5TJQMHug X-Received: by 2002:a17:906:f996:b0:6ce:e515:6064 with SMTP id li22-20020a170906f99600b006cee5156064mr16318994ejb.764.1645462153293; Mon, 21 Feb 2022 08:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645462153; cv=none; d=google.com; s=arc-20160816; b=ZuwGlOuA9nG42hganfAMG9AogrsGGRCh+mYGcRBFZvumCyC43EY46/1T3mN+ea9h5+ dcoWH9D4mKyDsoLc50nXvDoinRYP4dzX58A2ZPYeJdB4z5YjDe7Rqcrcbc/+MaF2vZLU G5ZuyBxwl8Skf1MBOwk8qosUsEhHDvAxKYaSp+b4a47y4EGdJVGwaBwM4CVoUa6czONR vZyfBEj5tMVzTJY06lDIPE+7M4MKjA0VLObd8+DfoAEsRxCukDeODlHdrQ58TGVg3iRf E+ZU4HPuXROWY5yG6cE95w0Syh9AM3veNohg6Htbr2Rsba8wcJYfcB0qMq965OdIEGwM iweg== 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=u67MZ7ZSowG4QDiLTytreYlEz+DOowPMSaYVLqn0S9P1RRmOaCNHhaLaR1f/yqw8tp OnT4AVkgMWhANLjYxpdCoPQ5wWkV+BFvummOlvN/TsRejftUrwtUxqwUyQK27HJz+Ml8 9R/14Jm9IIk+cNDMwHEuF/0xF4nraKlj7clfFMQVK3sEl92R+wzUnG0MZuW7ivvMgjd4 i/f1WnTUcoaNv/9ks82LcvNK+x3iSCR9Hn771eSRgIGCouVNsdAHuT1TvR8gdmYb0vxn Fcv7Q4wpMO3W22IpLHjLBlkg0VFCjqJGOpR7VUUYMCWTnqa5xpQxwAjXqbxUiP0OXm2G Gg/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FJNEeFQ+; 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 ym1si1374198ejb.307.2022.02.21.08.48.49; Mon, 21 Feb 2022 08:49:13 -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=FJNEeFQ+; 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 S1352585AbiBUJ4I (ORCPT + 99 others); Mon, 21 Feb 2022 04:56:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352936AbiBUJsC (ORCPT ); Mon, 21 Feb 2022 04:48:02 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7837C262F; Mon, 21 Feb 2022 01:21:35 -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 sin.source.kernel.org (Postfix) with ESMTPS id E8B83CE0E89; Mon, 21 Feb 2022 09:21:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4700C340E9; Mon, 21 Feb 2022 09:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435292; bh=GD8jGo6Q+HJ1uMXDjuZtebM7kKMzIBsEqRPZY3MkF0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJNEeFQ+THCQSC0Nh6Rhet/lPIQeMCmh5gIsJ0TfsmVTFMxThQ6cw7Mvvb6D/Q0uu MWsUPDn09SDBwPZsa03GLL4FCyFwbWVcCN+EmUwQjI8Zrgt9mrtk3rTUa5UgQoCP/H uoS+szlgNV7N6Hf0MFgsVzqLb+vuDlwCImz62iME= 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.16 080/227] drm/atomic: Dont pollute crtc_state->mode_blob with error pointers Date: Mon, 21 Feb 2022 09:48:19 +0100 Message-Id: <20220221084937.524263514@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@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",