From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6F8E23803F7; Thu, 20 Aug 2026 15:13:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787238797; cv=none; b=igYtZx0TozeydPtQheKgqhvWCDYomgafy353HD+/s1yBKfY4tg/D3gul5qRvomrvyiP1n9Yz7mt1et2a/fAcwTZAeIaa1OAX7ZN/rPN/a7HOS4z6nvpQhAk7gsiAZBcw+AT3Z2ZpbOIG1e9Y84zG6RgZbbg0MxykckojV+8oKic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787238797; c=relaxed/simple; bh=Mqyr85PSpaIxw6KtdsYk3nqTxDjvT5eiWvtv4yamr4k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jYyD9nkyOiN4JSOuFAr0zpxW6dLxSbtJeD1+L4Qk9KzDV2UAFmv4oVKC4vcNXauY+rbJmmrGUWxe7p9yh8tCt7PcON5/HTXWrr7ZNt5hD97hln6S4tKLqeIkLSwN0uSsSsUIdLv/4lH4e8T92c6NzaxjRTVjHzkjW5VX3DL1nIM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Go4ADrLV; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Go4ADrLV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C86211F000E9; Thu, 20 Aug 2026 15:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787238796; bh=fEqFfawPjV/5mfrH9cViPWTovJW+iHRRrJ7TBm5BkJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Go4ADrLVrFRlG1ZXzzhmtoXV+nTU1PpopTpzAc1ipNxdeU4Io1dpfDhfdZqdZ/uBw LwTMuJxoi/cmRDXxiA7EHWP2wJTcZiNW1Rj7Rz/eFgCLkRCdqC4IHZXL0Mc1VXDPPd 1p1nVIxGm3Ii9nIWHDOffjddJHPwuJqAjZvYYMak= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hans Verkuil , Dmitry Torokhov Subject: [PATCH 6.18 045/217] Input: synaptics-rmi4 - block s_input when F54 queue is busy Date: Thu, 20 Aug 2026 16:53:33 +0200 Message-ID: <20260820145238.978348882@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145237.531699751@linuxfoundation.org> References: <20260820145237.531699751@linuxfoundation.org> User-Agent: quilt/0.69 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 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov commit fbfd76746adc16d64be29ff113f673b70bc3f5c2 upstream. Changing the input (diagnostic report type) mid-stream changes the report size. Since V4L2 buffers are allocated based on the size at stream start, changing the input while streaming could lead to a heap buffer overflow if the new size is larger than the allocated buffers. Prevent this by blocking VIDIOC_S_INPUT with -EBUSY if the V4L2 queue is busy (streaming). Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics") Cc: stable@vger.kernel.org Assisted-by: Antigravity:gemini-3.5-flash Reviewed-by: Hans Verkuil Link: https://patch.msgid.link/20260626051802.4033172-5-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/rmi4/rmi_f54.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/input/rmi4/rmi_f54.c +++ b/drivers/input/rmi4/rmi_f54.c @@ -445,7 +445,12 @@ static int rmi_f54_set_input(struct f54_ static int rmi_f54_vidioc_s_input(struct file *file, void *priv, unsigned int i) { - return rmi_f54_set_input(video_drvdata(file), i); + struct f54_data *f54 = video_drvdata(file); + + if (vb2_is_busy(&f54->queue)) + return -EBUSY; + + return rmi_f54_set_input(f54, i); } static int rmi_f54_vidioc_g_input(struct file *file, void *priv,