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 876FF1A6822; Sun, 7 Jun 2026 10:47:31 +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=1780829252; cv=none; b=OBOUCXDvgyeEghnWSXmAB5n9TGiSGHM2EgagPvJoJRAaHdv/m0NJCZNruO/8GOByMtHVHkin2wU4ossJTfAnc/C5rGUhcyn+yeO/LkEqXlYE5Z46kdJveFfS6o8ghxaa9W4d9m/d6xGa0/EAuGhlKU2C/y5QroJMQ82PKzB4kAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780829252; c=relaxed/simple; bh=uXj2OdY3sTsv41fUIe5RfyZ5ekw9r4A/D4iTh7wa8MM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W8E4VZdKoEE/rxdyEs+uPvxrfoPGJ1IuD8TtwOg160UuwdLWcSxf3yIzzBCLOoTkCFWV3psJuTN0tAtnOz6DdX9rPkwKmj9NayL6Pd5cuvFZkwlx4XUMTDkxJs+y+6yDQcc6C45CB3ThxM7Qe8SiYYHL45++9PkxEA+1KWoJbXM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vr1jW37k; 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="vr1jW37k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCD401F00893; Sun, 7 Jun 2026 10:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780829251; bh=AznFM+bC5mXu0k5FOjZDLDs7bmfSQKOH6pFn5zxtBnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vr1jW37kjjfvCMO060ayhcoT4xHx7s2hPdzA3MHLP5Zfy+kxhkCG5RnEXrRxn2quD 3OJTlrKzyL1GWAhVn8QjtJv79KbpCq4BS1sjLxaEMjlYgSX0FrT8TBV0b3xMs3jWkY FTPM/g5pgOiIsejCFrBQeCqUX5yS2azu5iXc6byA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Ribalda , Dmitry Torokhov Subject: [PATCH 6.12 208/307] Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem Date: Sun, 7 Jun 2026 12:00:05 +0200 Message-ID: <20260607095735.357222185@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.647295505@linuxfoundation.org> References: <20260607095727.647295505@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov commit baa0210fb6a9dc3882509a9411b6d284d88fe30e upstream. When a configuration file provides an object size that is larger than the driver's known mxt_obj_size(object), the driver intends to discard the extra bytes. The loop iterates using for (i = 0; i < size; i++). Inside the loop, the condition to skip processing extra bytes is: if (i > mxt_obj_size(object)) continue; Since i is a 0-based index, the valid indices for the object are 0 through mxt_obj_size(object) - 1. When i == mxt_obj_size(object), the condition evaluates to false, and the code processes the byte instead of discarding it. This causes the code to calculate byte_offset = reg + i - cfg->start_ofs and writes the byte there, overwriting exactly one byte of the adjacent instance or object. Update the boundary check to skip extra bytes correctly by using >=. Fixes: 50a77c658b80 ("Input: atmel_mxt_ts - download device config using firmware loader") Cc: stable@vger.kernel.org Assisted-by: Gemini:gemini-3.1-pro Reviewed-by: Ricardo Ribalda Link: https://patch.msgid.link/20260504185448.4055973-1-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1476,7 +1476,7 @@ static int mxt_prepare_cfg_mem(struct mx } cfg->raw_pos += offset; - if (i > mxt_obj_size(object)) + if (i >= mxt_obj_size(object)) continue; byte_offset = reg + i - cfg->start_ofs;