Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796224673; b=NVtqRqaCfNBq6n2zJjaSIGzRoyh9IxNWe2onJ0jH1PB+OFZzBRxE09uyAOAe7nWIB8BM I+pZOICi/Cuo5pKN6zFTbRfNFxnIy2knWRBQrcIkZ/MRYCw7+Uy8hKozp6Cad0z/mRyWR nfSo093Q3cUHiMDVApbYk4OnZAtSohaGqY4inqdP2Ybu+i5JlM8yKVM6tGgIDVn6VOA6W dSkme7mmYTYPVB2WeUfocXhlSTdlympkKbsNpYUMZ5j6cT26ucyponLJgj4siXOHyWiOa jGIulGjLq/nunAbQVya4o1ZARqPIx9s5kHrin4vVAxOze3kUQdB+xQYQezUnkomEaPw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796224673; 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=cAleHaup1Do2cYMUz7qfuh54Dp692zFqIL93T3sQTZFbPZNlw+UYVRSXgb09iA5FdgBW CqIZpbr8KAV035uO3ZXw4GRMLLMBGt6chvbzkp/jmoV9CEeyBEskC607Kz0urlz3IBC1C 3NXvrb+13Udt0+V82cdarw4KTom47NYrM2oPd5anC30A5BOA0opny2JrFv8MDr5E0AWXQ X1WVwIbXCjR82of6UdGOmtwLcnzHWAIMlGSLjONoWCjD9tOz+28Hzx+jvB3OA75KQRuKH RXhOoWNMcowvKAeijfsDxVfw03vrIiT6e7uASFZrdpGNFdbtvRHfDRT2ewqUWrfZhUw== 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=74.125.82.174 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (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 F0054606A32F for ; Wed, 2 Dec 2026 15:17:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F0054606A32F 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-dy1-f174.google.com with SMTP id 5a478bee46e88-385c497bf94so2302806eec.1 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=eKSHKdXuXmKaSrkjOfcW3i1oQSBu6AQdkl3Bi+aR0EqAxG4Sb5K3XSlpx57C4zLV29 2wk6t2lHS/BN44Jep6UrAwRZFSlHA+QmHNluoFoRJ0WxXxnAK/0RrMw5ZIFEg0MUlMZB 8HN3c9Tm9rtg8rM27d4058W6QUM6wYn9uGtBuxo1Ah/TIqO3LwC2ec0mGkSwSSda+Tqj d6ZYkpm1QG/FL0iXcjnuWmAt/Dy4xCQiVkiOf10Sey7+wRMlLVRSFHOC8xNAkxqP//FT QZFM1uzrapCW12ediq+BV3Y9NbXrWBz8PMqidq33Iycgwd+uKBDYiTYbtjjbsDay4P4J pMHQ== X-Forwarded-Encrypted: i=1; AL+hErEWxnd2+ePbQb/ScMI7/i/js7lc9hXWQYCjMvJ/LuO/DOlc/34b7OfCcXfetsMIsDe/g3YZDVo6e3AZPg==@vger.kernel.org X-Gm-Message-State: APuU4Z/VBeeFgewgMtYoDwID9N7pbN2u4uZKy5ORJrGWK1SdIpFReWLa 1bPqTLPfnRO+X4TX5KWMEjIrJIzv/rm03YgSocAEwNbE4SId3LZNpH3a X-Gm-Gg: AZFdTZdly12GG9J/4R64fLdwQcj6uSNyntU5I8HV1+4mkCz9NKOX3emFbvdZP7wGLiW G8V1bazhDUggkNZBvJoFm5zCGf71/CKgs9vu+i9Gd4yxwqWX4jo2AgcBHpZUzamREAy6qF63W2P 3p2scV5cPmvKerOdJ5nGHL9SLJsLcBqCS8zWYIEoMId1yOuSy0L7M5td9C9MyvRKQh9yFJVR09l /W0b9q2f2LWfdTL8wMQEMWDWXoWhUFs9oyAN4pN1nkoZscsMjPZJ31mhkIMtZfcnkZYTEOH0hCg n5j/JtMGNZ3/IHCZMSieqIUlzXsR1QQ25hFrGsoDed/x8FW23tS31f/G764S68q9ipQobPVB7em M6jGwj0jhpC3Fua+yg25yTpWWkMmZnDaaVoJFCM1RTpMtsVogsnnp6yPmPnDMmzsHCLBOLXcCPx ofJBIr9frc7DNjcWPntJ2jCTYYs5oiRRLmx/c7Ouyd6uXA9GiKtVZ1pb9mFX1EnWe8hfK7nq+jR snsd0NyBa6S9jBiPz4EMJXW+TC3dV9AiPcLCHSjeNVp3+Yc9/6dr7t/UrIqDOS7MPpOhH5L0hcN bkp7ySmlTgskLeswyEvPp+WE9RB9yj5XJ5uq3ALrdjSzMAgXjRZdacDX91XzcHLGwZkcb8McoC0 Ilu3S8x4wsws7OmjYgOfb3vEBZadllbjRTiY= 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-media@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