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 5AA50332EC1; Tue, 16 Jun 2026 17:31:29 +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=1781631090; cv=none; b=a0V8h7VSA+gJAhofwgARI9YcDKWBFtcLemr+9RY7Z5X8lC/SwBX9Jo+Xu4BNs5ythAnry4P1EQV0Oghio8edevshYtsC6DQQDWTN2A460cpGKER/RfD0hkcPhuzMkfEO6QBmRmfZGtOqI9kXQe3EWZdV91LIvD99XcXjEnUGR8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781631090; c=relaxed/simple; bh=bNBWpj8kIONAE2tufk2sFav/cq/KVxSytHAJkjWpras=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YHG0t0vH2gmlsX0ZtGwYb42c74x6/ObRC0wkgc/i+V3c+3hperDI+YmS4kv4yaKULxbBleCjZ5MehDR1UisXX/YGz9ozw0gVwk3WKiFCYEHuoEibxjIlh3lolm/S5dUEmvLKXj1Mrg1cY5OjBaaqxmCnY8un334wO4Sv20q+oYs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=W0uOZbPN; 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="W0uOZbPN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C6F61F00A3A; Tue, 16 Jun 2026 17:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781631089; bh=BwCKlC0PUYQRkpQjVJvyNOpG9Y7ThPgOBJIwUhG2dzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=W0uOZbPNX24AeMKz1rfKrohbrP4PSg4HMjY3uVbgC0AmZ+WoTP4DLgYh+NCCdky/I z2HnbggskmOdXtYqQJvV/CSC/ZLLgdMYAJv8W7Sr1mkZOiMhK3FOJgzOrz9dom6ytP 0ypGEXfxxO+9OnT4tOJmuvye9lixhhaOmHzYySHU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Ribalda , Dmitry Torokhov Subject: [PATCH 6.1 137/522] Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem Date: Tue, 16 Jun 2026 20:24:44 +0530 Message-ID: <20260616145132.514292792@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145125.307082728@linuxfoundation.org> References: <20260616145125.307082728@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.1-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 @@ -1443,7 +1443,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;