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 251C528BA88; Wed, 23 Apr 2025 15:04:37 +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=1745420677; cv=none; b=Xne8EuzwHXE+zaID27FlQRo6S3CtIHPm7uw/j/qtvWd2dOMu7M1aUzj/HqJE+4qu9SGTRnLL9sLJcsqnOcqK014p8TPHHCIhZDmIiPzJF8Y0EFTprL/CJW2wDoo/oa84eV7DsCnCXY08Vva5m/cLt5/FIQjzA3mNT6ULeP3211M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745420677; c=relaxed/simple; bh=1ty4Gve/xoaFtHhDA/pPHNB2KjSRtE4JpIX8tVD5RXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tBRRGL7qpLL9Mf+DZels6JEiLyAF2q5QbaL0fniyV3+tAkkXJxJboN9lYNDnxuLYo2CyamJY5oIJa4Q6D9+ffegN7GAO3TuBCxAZ85O+FxbNd2nKUEWtopEYVYxzJo0Mtfn22RdvAspsheASU8J8SoNanbeutzuurJqeTtg9FeE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=P4RDl162; 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="P4RDl162" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAB59C4CEE2; Wed, 23 Apr 2025 15:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745420677; bh=1ty4Gve/xoaFtHhDA/pPHNB2KjSRtE4JpIX8tVD5RXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4RDl162cx9nCipbWuC7N46mDoaBfqJd/ctX2qKKM3VfdU2RD0lJA8fLUhtBDnixv PZy72wHn5DMW3TsyGKgbdhFAaJkEMz4bVsGGyh6mw9Zwresh/lgsJgVITC0zP7r6as +nytIPar++IwnLmVuViAEs0UXKTu7CqEeoLnrhXo= 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 6.1 070/291] fbdev: omapfb: Add plane value check Date: Wed, 23 Apr 2025 16:40:59 +0200 Message-ID: <20250423142627.233721679@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142624.409452181@linuxfoundation.org> References: <20250423142624.409452181@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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 92fb6b7e1f681..a6225f9621902 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dispc.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dispc.c @@ -2749,9 +2749,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