Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1576927pxb; Tue, 8 Feb 2022 22:53:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSyC88iWi0MgCtXd9Ihas7RFQr63WdaAP0F92O/Yk8pLiRnfjw60EVtNgpYIXl5RoMuDNQ X-Received: by 2002:a17:902:cf0d:: with SMTP id i13mr795539plg.72.1644389612142; Tue, 08 Feb 2022 22:53:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644389612; cv=none; d=google.com; s=arc-20160816; b=K7KuwYDtIz6Tn8Gw/Y0m4JeI2J17wBwa4PhT3MNkwKJpQ1XMbVwTnO9txDF3zMIATP r2KKkRyYWYcA6pYVuiWdblvTI0zyyQ5tysK2TVVPmsCd3QWYX2jTvNtHHT/6VURuql9E f4lEfWQ17+z3g9FucoHULNJYYsUwpS9i4hcbPq/Gxoo5I+Hy3BgGN48An122WVnVaJ/2 keF861PSOMoh+zd8lUTXdXpB6EKcAqu90gpS3DJooArXMTgqrncuY7wD+y4FrKs8A+aW qvQ/NLJN7vIsYwIN8ph0nEqy9g3nl1IT2t28CTo7aa3ek0e95MGFHYQsFZ/3cPBbjKNK sBKw== 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=ISIotKzA1Au0/S4AtHW5L6Y2sirzqAwiTrRjW7XVOLM=; b=IPimqtgQgKfuA4dDn/mRhPxdHGTQMynW/hfzMzywwOl9Wbcus8AHb+mX+ZOv0sivMN asij9UpyByN0GXai1MT56ZP3PWSfCHvFJYO4XtF2IcaA9BOCneoXalb5L7wjopfgF1Uo D0QcIk0TRRO4zzPvBUoYnaZWXLU8Gby9cnZ/Jq5d7mEIeZ839oVjoL8kLe1b5LipONfC LVQyO3tcfkecQkQP73SnEYFaPoUih3i3TnLRYnEaGpz9DqIi3lFkGcE13L2sMMjNduMJ GNzR+6TZFWizfz1CPB6OlRsPzcmDxJjfr5NdukCFHtJvl2Y9Xh9rzjiIGOyjBl6M21Y+ o7FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pAQX48k1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id go24si4103918pjb.109.2022.02.08.22.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 22:53:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pAQX48k1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1631E00D478; Tue, 8 Feb 2022 22:30:08 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381630AbiBGLqy (ORCPT + 99 others); Mon, 7 Feb 2022 06:46:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386260AbiBGLeN (ORCPT ); Mon, 7 Feb 2022 06:34:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 096F0C043181; Mon, 7 Feb 2022 03:34:13 -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 ams.source.kernel.org (Postfix) with ESMTPS id BC6C7B8102E; Mon, 7 Feb 2022 11:34:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3913C004E1; Mon, 7 Feb 2022 11:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233650; bh=sRT0SUtVKDDdJobDZ2zVLyItWfN68H3/PvgmN5nr8u4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pAQX48k1KpaRE1imS8OK63hG2Fs2FQgVHrj599ZYMUKQ3C8yDmTK6wE4atbM+D1AG tZP+JKGGGF+thWWS0TG56Z8yWbfSVSfZApLCIOV67+BcrChMvh56152mRD/4FCbJq3 1+oEOdiQVX82SAz7sF2gNyuO8vsV6W0UiUW2vr3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Marek Vasut Subject: [PATCH 5.16 078/126] drm: mxsfb: Fix NULL pointer dereference Date: Mon, 7 Feb 2022 12:06:49 +0100 Message-Id: <20220207103806.805730351@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103804.053675072@linuxfoundation.org> References: <20220207103804.053675072@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.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Alexander Stein commit 622c9a3a7868e1eeca39c55305ca3ebec4742b64 upstream. mxsfb should not ever dereference the NULL pointer which drm_atomic_get_new_bridge_state is allowed to return. Assume a fixed format instead. Fixes: b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present") Signed-off-by: Alexander Stein Signed-off-by: Marek Vasut Link: https://patchwork.freedesktop.org/patch/msgid/20220202081755.145716-3-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c @@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(str bridge_state = drm_atomic_get_new_bridge_state(state, mxsfb->bridge); - bus_format = bridge_state->input_bus_cfg.format; + if (!bridge_state) + bus_format = MEDIA_BUS_FMT_FIXED; + else + bus_format = bridge_state->input_bus_cfg.format; + if (bus_format == MEDIA_BUS_FMT_FIXED) { dev_warn_once(drm->dev, "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"