From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9D3FBE4B for ; Mon, 19 Jun 2023 10:53:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F4D9C433C0; Mon, 19 Jun 2023 10:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687172003; bh=Qmg4m95kXTHulmBwy4vttPcI9/RTDXVt+7nl/uOnvww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jNUfqWwz1RTJbiscqYFq1msMm8mf+0lBmzLhLK8Y8/EDs7czgx9vaq1IT6K+jSHoe g8AzWDMhezFGLYNvRSdqc4pasXZLqOAztmiaTtgcwfckl+RJybRuuGw0ZCtusTQIBe Yrg7KOacs+oCGPLNqhnSSXyseSICJezjKyxjeYaw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Natalia Petrova , Lyude Paul , Sasha Levin Subject: [PATCH 5.4 54/64] drm/nouveau: add nv_encoder pointer check for NULL Date: Mon, 19 Jun 2023 12:30:50 +0200 Message-ID: <20230619102135.649758468@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230619102132.808972458@linuxfoundation.org> References: <20230619102132.808972458@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Natalia Petrova [ Upstream commit 55b94bb8c42464bad3d2217f6874aa1a85664eac ] Pointer nv_encoder could be dereferenced at nouveau_connector.c in case it's equal to NULL by jumping to goto label. This patch adds a NULL-check to avoid it. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 3195c5f9784a ("drm/nouveau: set encoder for lvds") Signed-off-by: Natalia Petrova Reviewed-by: Lyude Paul [Fixed patch title] Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20230512103320.82234-1-n.petrova@fintech.ru Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 048a04701910e..85a20fe2709af 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -730,7 +730,8 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) #endif nouveau_connector_set_edid(nv_connector, edid); - nouveau_connector_set_encoder(connector, nv_encoder); + if (nv_encoder) + nouveau_connector_set_encoder(connector, nv_encoder); return status; } -- 2.39.2