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 0CCFE1A6822; Sun, 7 Jun 2026 10:47:45 +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=1780829267; cv=none; b=teF8FmxEASTxPkJL3yYrYjfEsxnKggaSsTOxO9WjFt4kFQmzUqvSY1P0HWgu/dnNTUcknbHjmAaK9RMJ6ohJB57//33FssQg8p+WJh4bthxIAJO675eKqIAY8GLWPx+qnGf/qRuOn1tox9lnOzwCCxTx6j9T8BjeNL8+WIMGaak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780829267; c=relaxed/simple; bh=oY8C1zDvpsjGSxp5tM6e1YFcZqHZWyjdAWdtiBeD0X4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TAC2u16U/Lp6QbOkInN/oG9F4yZFXLmDEJbQSzdEDQPVIIFEeANE/FjFITiWqM01dMnRCAeY3J0Ol8WbOHOSJsKQFm4qgXCbcOjxlzs3+1S7kW039uma0DGHSlS7C7JFlS+dZ5uBWrPST/rq2QZpW+BhctjUNsOwi9ydhcUzZYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H4HV41Zy; 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="H4HV41Zy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2121D1F00893; Sun, 7 Jun 2026 10:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780829265; bh=1/DZgY7WmPmHcPQLvsUcVE+fRQ64HPe1BwNZtjT6xf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H4HV41ZyAun1d3fHi9yyKvohYmfd1Y1jxk3oJegHZY8jD1kqMNEUUW4wsYwVeOLMy wftIPyw55TizKw5Sb0nXBsS6yLvtXJbEYxKDlDzyjnWEFDoiZNyDhEAyh+bjI70dfl gT8m/XI7hvp05n6Pzcs0YcGTfKHfb2pgaVUu93IY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Ribalda , Dmitry Torokhov Subject: [PATCH 7.0 241/332] Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem Date: Sun, 7 Jun 2026 12:00:10 +0200 Message-ID: <20260607095736.901915994@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095728.031258202@linuxfoundation.org> References: <20260607095728.031258202@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 7.0-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 @@ -1477,7 +1477,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;