From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796224672; b=oCK7Sun/2czPU8J11ziob+L+wO43noNbF95HLzzDL8uDRcuTAVTxHTfkdcfyrLqTL6tZ CTUZGRCNaffNwzhBMWtFyEr/0LeVBv5m0H45vxtpt9+dm/RjwPjgpwJNP9uBBKxfq8qtC nECK6W9k1jspUWiWwus2TtaZgkmnkM2m7Toy8UdpY1LPgBFXyS7P2JLfP59kboqSwfv3Z o3d8STLZONOtkR7rE799rPeRUw2shp/kINjRof+cwnjalg5k6RjuqjU09OeD5FRywCCgv bbBMlj2Nf6es/EvLCZEF0HfVMHw8Ic9A/1QeC0Q3+HP8iBN0BYp3g7gQP8yc9xKB74A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796224672; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=VE19CAWZjuy7XcwIc7/D3s2P+coMRJi6Y3yIX70U4qw=; b=AMTEcx7FupMKiRPfLkryDd4jaSJjOHuL5mx1/MrjOTTxhcJXveZFcwaphhbB7uO/c7hn 5fd6e+3ysxpsOkDPw/XtYRw4q7QK7tFAMQRrXVlzhPCceCDfUY1g73wjFIWJ4XKgxoFx7 yT5XOdo3GSaQQMxR2gPupUbaMq3PJSz/ivwR0mRJMhOnpQsgOE9XXa4y0PnOED3t//Apf gVCMBw5SzXUSxtiUMBdusletdPZg17YxL34G6GBNSoOny3Og8Jmr8ABblRDQ04ABHgqs6 zqqr4SUQpERG2xI1m7Y1DHzWem45Lj91ZI4iJUKZLZxfeQauWiQHI1yfh6X5rHGzpXg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ZvREu8rt; arc=none smtp.remote-ip=209.85.215.176 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE19A606A325 for ; Wed, 2 Dec 2026 15:17:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EE19A606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ZvREu8rt Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-cde827b7b95so4812863a12.0 for ; Wed, 02 Dec 2026 07:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796224671; x=1796829471; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VE19CAWZjuy7XcwIc7/D3s2P+coMRJi6Y3yIX70U4qw=; b=ZvREu8rtf9MiRflmmMadwdWLzvNxzj5RBIhBv4dIIqmiAHUvuyEfeBpRdLM66iR+Dc eATwsYUiVJn21fVyx/iAdDF7nJhdAG9S4opCzny1VnD2VVPDOyhla4UqjJrxQRm7a9XD KxneCMnM7cC1uXd+RoIcyphZj9h2CyaNIPJ+PM15CEYPbSpTQSwyreQQvlAV8BCsnMbC VCcVMsks5hjlw2pIjU6ROwMqVNxYHToIKYPdajXD8Q6125bWxlxN7h+CE48xFRkSbERy M46RE0jQgAtVOWpc5lAnfRSrcSVdavR2hTypExn6y52HB4QkfptSznpwBTKEl58G7Kp8 xH9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796224671; x=1796829471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VE19CAWZjuy7XcwIc7/D3s2P+coMRJi6Y3yIX70U4qw=; b=AHj9RLoa8zAl+A+frauMScFoWojzrtu/ztqJqO6cM/p+l8I8kVHuL4JvbXbMc9EQ62 cowZkwl8hoTHJGABU4Z2vkw4bFiWZiKyZFthVLCk7DAm9VdShSW1RI1fBFiDlh1911zU Qy6vj3ALaeavGlLclW4vCzlPoOzorLOVWh7JPVXERW2OJVXA+cbaBCZ9zYs79dqQuYUR EhkaY2dUcEejNxOjTVKzaO0GiXTDXPnpkJm44j7nNbJGkDh3cerXcoFafSlpqs9aoNyD buvN4NOitUwfl6Z+mjcvf+N/LJRXLNVG3JZUOI5kgGPduEtaOXQKdlqD6qwI8YjEsA+L qGZA== X-Forwarded-Encrypted: i=1; AL+hErEByq3vd0HhgMC1i5eZlfIbCHOtSdITuDZvAVQ886BRu7gAMwMitgHWP3ROYSk/uXQKdstTRc72L/7VSiU=@vger.kernel.org X-Gm-Message-State: APuU4Z+IGPSL7dde3XLK9IvcR6bUu7HfivJhT2T/9yUq/fDPfwkSYcuc Kd9ib4W+exZ6L7+tZUyGRJtx2JCOKfXNseQPB3BVgUKAza98hQf0UdEI X-Gm-Gg: AZFdTZdCVipxYQXfrJO1t8VS8L2dD83P/BEnCV4mPfL35Ao7rVXiI46rrz65zeRfFQt oKgdR7wjbesB6CzH3Pj0YAh5QtuxzRnPoIiMIJpJ/ZaOqbswLhTe4qLoEx8gBZoOrbYXQtHJxbd 843bPp5Sp6aUZKzEkFqH412IOH+9zdqkm8tJP/jGNZ4iKjdMeVJ3HkscH2sI3j/W0BfnPZX/eSP +4SM4Aj1IgUpuZtm+XEmTaPHRPUFFm21GWe8ME7/JaNe++nO7mLOCC9KZ9BaPlla9tO822yRhs4 bcCoBWIkfOqBUCpr/C9ETB+FgCV6YoMFwQqaPxgGJRqEDCTADrQZisiBpzyvOYjPq4NSfkpm1Y8 ybDfwGc63n8rkKE6B+eYVev8Qptnu6hJWeV9SW5J/aZCgY8tiUirS1P5K19dKMFqsuuEEiDUBQQ a1UDyhUv4jm2U+KQEXCbqlnVvRCc290/YtCeRkHQrWj5fgMTwmyz+YibNu/nvVVtOJFptArYnjY p1czTU5TJEERVXWd2T15bwfjkJ8OfL8iZVFGUrd/OYeoi4TALHroEAcf62c8g18bzeF0XUzVQ+u sJx8tkm8OgAIVNf1fQpIsEB458h704tAfBxxrF+wsx5r5s5SaFGoiuQQqXEHHVuKm1XHOnI3sB+ 9KoiyOw37+7OpiskD1rk+5q0/TX/wSToIniY= X-Received: by 2002:a05:7300:fe4c:b0:386:9b1e:dcd2 with SMTP id 5a478bee46e88-3869b1edd57mr38231067eec.20.1796224670956; Wed, 02 Dec 2026 07:17:50 -0800 (PST) Received: from hyeonjun-ThinkPad-X13-Gen-1.. ([124.197.199.8]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386aaae4960sm83959681eec.18.2026.12.02.07.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 07:17:50 -0800 (PST) From: Hyeonjun Hong To: =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Mauro Carvalho Chehab Cc: Geert Uytterhoeven , Magnus Damm , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/2] media: rcar-isp: Account for the header in the ConfigDMA bounds check Date: Thu, 3 Dec 2026 00:17:17 +0900 Message-Id: <20261202151718.694973-2-hyeonjunhong330@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261202151718.694973-1-hyeonjunhong330@gmail.com> References: <20261202151718.694973-1-hyeonjunhong330@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit risp_io_params_buffer_prepare() fills the ConfigDMA buffer with address/value pairs starting 8 bytes into the buffer, the first 8 bytes being reserved for the header. The bounds check in risp_conf_dma_prepare() compares the size of the pairs alone against RISP_IO_PARAMS_BUF_SIZE, so it accepts one pair more than fits and the last accepted pair is written to bytes 16384..16391 of the 16384 byte buffer. The number of pairs is controlled by the parameters buffer queued by userspace. v4l2_isp_params_validate_buffer() accepts repeated blocks of the same type and a header-only block still results in register writes. For example 171 header-only RPPX1_PARAMS_BLOCK_TYPE_CCOR_POST blocks with V4L2_ISP_PARAMS_FL_BLOCK_DISABLE set (1368 bytes of block data) produce more than the 2047 pairs that fit. Include the header in the check. Fixes: 2151350f60d1 ("media: rcar-isp: Add support for ISPCORE") Cc: stable@vger.kernel.org Signed-off-by: Hyeonjun Hong --- drivers/media/platform/renesas/rcar-isp/core-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-isp/core-io.c b/drivers/media/platform/renesas/rcar-isp/core-io.c index b60b91f43d42..5c6018491160 100644 --- a/drivers/media/platform/renesas/rcar-isp/core-io.c +++ b/drivers/media/platform/renesas/rcar-isp/core-io.c @@ -507,8 +507,8 @@ static int risp_conf_dma_prepare(void *priv, u32 offset, u32 value) { struct risp_conf_dma_write_desc *desc = priv; - /* Bounds check, 8 bytes = address (4)+ value (4). */ - if ((desc->count + 1) * 8 > RISP_IO_PARAMS_BUF_SIZE) + /* Bounds check, 8 bytes header + 8 bytes = address (4) + value (4). */ + if (8 + (desc->count + 1) * 8 > RISP_IO_PARAMS_BUF_SIZE) return -ENOMEM; (*desc->buf++) = desc->base | offset; -- 2.34.1