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 01D3D227E95; Tue, 29 Apr 2025 17:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745948578; cv=none; b=oqm8gXl4z+UdvhwweQvnj5WdJpZiZPNFd1v/XQpgT3fSLTy30SIy8o3DCs4QFcun0vH9X7T3mFJHqJ9uGu/ZmUvWeL3cJrBe2a4LVXl/07M2X018vcafoTilv5u+sI64TA9LN4gNy+/9wPk7q93SIBrttPPg8M+SSiOXR3gv0IA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745948578; c=relaxed/simple; bh=rpkdutMEKqOjlj+RveO9jeNzxNVlHbTo80k/GBw7es4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZbDvIu7OyVe8DIAwf4A3wHzVkKZgN8NUVi9vBZbDOcRxtFdH8qeLLk4nA0CrlJ5ZL2Ha1v/9LWcQZpjWfmmhitfo/w/bzo+VlBvAjr6MgEsalzmcdyjIAABHRaSoM4s4PimH4nQ5+RI6QhbA/dKv7G2Iw0IcJCL33fdttUnWs9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rE2/2s3h; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rE2/2s3h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0E14C4CEE3; Tue, 29 Apr 2025 17:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745948577; bh=rpkdutMEKqOjlj+RveO9jeNzxNVlHbTo80k/GBw7es4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rE2/2s3hXQCKpcQkVcwr5RYJG3i6DeBkJrCkqSrwq/1U7Uxpeh9T9daUhFa27pFSI p/auVY0WjIRH66CqOgkyz26lMFNoOguOXhvkDtZR7F7o8Ai/rPPUwgtFwrSrGaldaD qhVdgw5XAgJniE9XpPDyFE1Xxe1WP0B/mjsAv27M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Leonid Arapov , Helge Deller , Sasha Levin Subject: [PATCH 5.15 049/373] fbdev: omapfb: Add plane value check Date: Tue, 29 Apr 2025 18:38:46 +0200 Message-ID: <20250429161125.148858038@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250429161123.119104857@linuxfoundation.org> References: <20250429161123.119104857@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leonid Arapov [ Upstream commit 3e411827f31db7f938a30a3c7a7599839401ec30 ] Function dispc_ovl_setup is not intended to work with the value OMAP_DSS_WB of the enum parameter plane. The value of this parameter is initialized in dss_init_overlays and in the current state of the code it cannot take this value so it's not a real problem. For the purposes of defensive coding it wouldn't be superfluous to check the parameter value, because some functions down the call stack process this value correctly and some not. For example, in dispc_ovl_setup_global_alpha it may lead to buffer overflow. Add check for this value. Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool. Signed-off-by: Leonid Arapov Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c index b2d6e6df21615..d852bef1d507f 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c @@ -2751,9 +2751,13 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, bool mem_to_mem) { int r; - enum omap_overlay_caps caps = dss_feat_get_overlay_caps(plane); + enum omap_overlay_caps caps; enum omap_channel channel; + if (plane == OMAP_DSS_WB) + return -EINVAL; + + caps = dss_feat_get_overlay_caps(plane); channel = dispc_ovl_get_channel_out(plane); DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->" -- 2.39.5