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 96F913C1081; Tue, 21 Jul 2026 22:01:08 +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=1784671269; cv=none; b=GZF/U2pf1CteyC140QEx1gbZX/CtZNTY42n7MRwbgJ6xirRqMm7K41TNWf6mOTCrlQ/w7VXM2B7q0rMxCAxOGNa+BPm9K2k/0tQdr0eTOKjIT1j5cPCO8vu/v5906awa768yy4ujfaDkv+litqMNLQHsSp3EVa0+B4cjU4hUwo0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784671269; c=relaxed/simple; bh=9Gn182ZPqGYOLOWFaOefdTrFvJ5L7S56g39ZU5g/wPI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lT9szh6NkoG2k9xhmHjk3qhOR7XP9RIcgpDeRtd0v8qlxsyLqCNL2zT99fjUbISivFvK/B/2tSamZb7eFu7AE2iDZZL0kJpvvOc8cslP94GkgeHHYdNthdZd4QSHz7TceiRyYXToK/sMwHsat+JdKDpBM6bSATO37rUj7YoWsEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hZClZ36T; 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="hZClZ36T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06EDD1F000E9; Tue, 21 Jul 2026 22:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784671268; bh=xyMRYbBSnUignmKeDqR2dnJk9ML5fwrdy7JL/uhzxIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hZClZ36Ton2QSbgcoWNIjLZQ+m1MEczISgvw2c4K8LQTmy8lf/grF6dDvzG3538dr Ut2f5DWsQUP/WbLdnpbv8VARrUbuAHBO5jV0+AnoU0S5rm0kUZzXyGElz2PpN7XEIV P7XQV/PgP45iJgbJTrVubREuKqMm0s1U8AUKINFM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryam Vargas , Dmitry Torokhov Subject: [PATCH 5.15 183/843] Input: synaptics-rmi4 - bound the F30 keymap to the GPIO/LED count Date: Tue, 21 Jul 2026 17:16:58 +0200 Message-ID: <20260721152410.134798850@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bryam Vargas commit d577e46785d45484b2ab7e7309c49b18764bf56c upstream. rmi_f30_map_gpios() allocates gpioled_key_map with min(gpioled_count, TRACKSTICK_RANGE_END) == at most 6 entries, but rmi_f30_attention() iterates the full f30->gpioled_count (device query register, range 0..31) and dereferences gpioled_key_map[i], and input->keycodemax is set to the full gpioled_count while input->keycode points at the 6-entry allocation. A device that reports gpioled_count > 6 with GPIO support enabled therefore causes an out-of-bounds read on the attention interrupt and out-of-bounds read/write through the EVIOCGKEYCODE/EVIOCSKEYCODE ioctls, which bound the index only against keycodemax. This is the same defect as the F3A handler, which was copied from F30. Size the keymap for the full gpioled_count; the mapping loop still assigns only the first min(gpioled_count, TRACKSTICK_RANGE_END) entries. Fixes: 3e64fcbdbd10 ("Input: synaptics-rmi4 - limit the range of what GPIOs are buttons") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas Link: https://patch.msgid.link/20260614-b4-disp-818d6bda-v1-2-cf39a3615085@proton.me Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/rmi4/rmi_f30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/rmi4/rmi_f30.c +++ b/drivers/input/rmi4/rmi_f30.c @@ -233,7 +233,7 @@ static int rmi_f30_map_gpios(struct rmi_ int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END); f30->gpioled_key_map = devm_kcalloc(&fn->dev, - button_count, + f30->gpioled_count, sizeof(f30->gpioled_key_map[0]), GFP_KERNEL); if (!f30->gpioled_key_map) {