Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796224669; b=Rp2ctgEYcnUIgOGiw4qMmnisLpq6gFZ/gPvEa5vgvl38tEcU2T81/EfOQqSq4kyNfQPt g/EWg18IMf5vgE+29EsqbH3uvsLrmS8ODp0pEloNffcyCKpM9uGe1bplkNyT4V9fXHhza LY7UashNiUtghpF9qp//9re7vTxDraG0lZVaBotJ0YNJbwqI/CJTB+PBwZ4rzkVR6MdJM cZHqqpmyXL9rm2QPbwRuSHgzDCPvttnnULvpmoZZXKZCcKvEuf5CyvhObg1yRcIjzrQ1J 4tY/ygLf3nsGQuXr1s337v7XzUlkJiiCxs7BobeeyBOFqo1IQo5UxDlOxKvHR08rC5g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796224669; 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:MIME-Version: Content-Transfer-Encoding; bh=J0y+IPajZ34hiyeVK4mleoV1jvPymbuA1+/Llv2zs+M=; b=xww1euN4NQG6MP1tYp7EGFuywU1/pT4xfxvg9QcsTA/5DgI7FAjBCWX8ynXRGbguyacN GI3FWprJP46E24sjRrTLbhqo5ViSKePXWjDNcL3oyfnRJKWxblLcks9KtT5/EGDIz39NP En16Qg30HmTx0BfHhVzkRU16qWlLTKr2Cvqrg7QjoOvWJFdLuBaFE/vI9yvD8q9FImOak gKBfb+KT8XLsZwkgdxZOOJQuZyP8cI1OctXzFXsd0SQBxhjkQ/IYMxZtMiSWsMQ6OBYUo 3mhitAoqNRW/CyjAk8A6IDxaQGDCrtaBmU21VrLkP6p9bLhsXMb9krmHJKRiCUw4DdQ== 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=iomG58JE; arc=none smtp.remote-ip=74.125.82.180 Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180]) (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 B4D99606A322 for ; Wed, 2 Dec 2026 15:17:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B4D99606A322 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=iomG58JE Received: by mail-dy1-f180.google.com with SMTP id 5a478bee46e88-38699cf08dfso18424870eec.1 for ; Wed, 02 Dec 2026 07:17:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796224668; x=1796829468; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=J0y+IPajZ34hiyeVK4mleoV1jvPymbuA1+/Llv2zs+M=; b=iomG58JEgoLcht6KMn91/k7FvDJKJc8dL8M/tD+HrSMkFoX/urq/QoH3x46v+zNApa 7XUWiDqBkuxyOPMHFWtsEJbdJy8aeTDyTZb0ntfaxBIHwi6pfE5IAA+jOHsKPvW1CpYI 2bXx0qH7SB4YwXGRn9Euc4+RFi4hDYlRZyAn5Zz987H3JqPgER21ElVD+3qLnpphPk88 poHR0HzRZTq3YuTDwU9oCk56JOt4l18PcRjSEQBXK7unnFk+jltyOpzt9oCQZN18kJiq U1ZdX7lGH6SmxhOdMgdHpmFkuqXjL6GuZZuFRjvrknS2V/rqjIDYkdVPv7PGM5Yi8eye giQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796224668; x=1796829468; h=content-transfer-encoding:mime-version: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=J0y+IPajZ34hiyeVK4mleoV1jvPymbuA1+/Llv2zs+M=; b=osubWBwjiI512QrBCFtaXyehRWVAqW0h8FNRjlnwKrQFMo9rUK+smqdzn0JbNC19Z4 MqCPNG/R8418WbRQkDvpO8k7gObgulA9TFVcxvb38gKhSbN5wCMWoYAE9AYFFl3m3hGw 5CMEyUwDdBme6x09KW2Ioz5TkrClpusFXqx+yHboio4DWCzTqDgtP8Q9wl2JYQ5+ZFEH lcGRBSyH8GhkB8YepiK+DXUqYd8w3sTYalrX2IQAkiH/JfPai0w6n+AyGjVM16j2IXXM kK8ZM64lXvHKZDXfzSDK4DHrkFahY2Tpkp6RBkOk1mimuZXnx/vCcZGgiyv3dUXc86jI LCng== X-Forwarded-Encrypted: i=1; AL+hErGBW1V4YJDvHF727Wk+iCXA/nd71BiixNdNB1EYZSPqDvjcg9NoG2X2UqfuB9b3bMe20WKrUjLfC59TKA==@vger.kernel.org X-Gm-Message-State: APuU4Z/d+9i5r+TdX3aRNBqsQnDjIMVsPwT1Mx/snK0e+jSAYrj9cW/J oZmD8pGdOE+kd1dNwhRJcpvKYyzQ6tReO2g6AeBCKfp8jX3TGynPm3qq X-Gm-Gg: AZFdTZfXFX7Jthi2L+84YabLV/gvjcJrwTaAuOklabrU2yl/nnGDWLk16Uen0JSMCkh 1cppbrUegCM80957tiJ1G7D9mdfXMYvpdm8duDouAUvcZGBhR7vU8ZMhUnXwlop3+Ap0Vs2+pqW n8KGVt4vcACysPwS6y8wNYfpUa/oGnfLNsX6yqKmKWPOKh61IaQjVql3n61tXzqwcxrzOY41K7M WALQP18RaNNruWKxucUwESW6HVcHOPexeK3eAT0ejMaJFfFMpg+3jG17byo9B0OYEBnDs3nvGqx QWPXroXzBnc1z+bzfWeuZHm29KW5my+89zws0DwoAVV+G+5YOWsfbx4YBZjPvobN66bd45z9nOd AHqZGob+8KJCpldDn90YJCufL0oodgFL44+ykFkEzjPgaLJuKcORTwGzIPyySb5mVUz5kzSJRFp 66hLKNeNStceYGeW9EjB9LOTYbfvnGtCBdxTgagkL+WpHdRmMbw78PHjxOlW6G62JyGDnLNAmbu O1GYP1u46/n9PqP9JoT/S32opMjZer3JeR88N8eK6ZILjEPZnmWvL7y12FH/A1QWJQjvUYcljMW ZqUbKkFJvw1DRZr0PBRLKDhCS7/CmE71frH6Kt/v5S5BhbF8HeOi1fZ2tvxL2Qz63hLtJDhrTNK Hqjdg+AbUiSOmXg== X-Received: by 2002:a05:7300:da13:b0:386:d0f0:5f75 with SMTP id 5a478bee46e88-386d0f061famr22729204eec.6.1796224667442; Wed, 02 Dec 2026 07:17:47 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 07:17:46 -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 0/2] media: rcar-isp: Fix ConfigDMA buffer overflow Date: Thu, 3 Dec 2026 00:17:16 +0900 Message-Id: <20261202151718.694973-1-hyeonjunhong330@gmail.com> X-Mailer: git-send-email 2.34.1 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 Hi, The bounds check that protects the ConfigDMA buffer of the R-Car ISP core does not account for the 8 byte header, so one address/value pair can be written past the end of the 16384 byte buffer. The number of pairs depends on the parameters buffer queued by userspace on the params video node. Patch 1/2 fixes the check. Patch 2/2 makes buffer preparation fail when the buffer is full, as the result of the write callback is not checked by the rppx1 block handlers. How this was found and tested: - Found by reading the callers of the v4l2-isp helpers side by side, with the help of an LLM (Claude). - I do not have R-Car hardware. The overflow was reproduced only in a userspace model that compiles the unmodified function bodies of risp_conf_dma_prepare(), rppx1_params(), the CCOR block handler and the v4l2-isp validation helpers, built with AddressSanitizer. 170 header-only, disabled CCOR_POST blocks: 2041 pairs, no report. 171 blocks: heap-buffer-overflow, WRITE of size 4, 0 bytes after the 16384 byte region, in risp_conf_dma_prepare(). With the series applied: stops at 2047 pairs (16384 bytes used) and returns -ENOMEM. - Compile tested for arm64 with W=1. - Not tested on hardware. One thing I could not resolve from the code: risp_core_job_prepare() in core.c limits the pair count to (RISP_IO_PARAMS_BUF_SIZE - 8) / 16, i.e. 16 bytes per pair, while core-io.c and vsp1_vspx.c count 8 bytes per pair. With this series a buffer holding 1024..2047 pairs passes buf_prepare and is then rejected when the job is prepared. I left that check alone as I do not know which limit is the intended one. Hyeonjun Hong (2): media: rcar-isp: Account for the header in the ConfigDMA bounds check media: rcar-isp: Fail buffer preparation if the ConfigDMA buffer is full drivers/media/platform/renesas/rcar-isp/core-io.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) base-commit: 62dfd7c0e599b6f02392b117ee77a070796ad765 -- 2.34.1