From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 051C02571A9 for ; Sun, 26 Jul 2026 04:41:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785040902; cv=none; b=L2SdejyhzGUetnPcjiIDWkhxzXtz0hJXltRJhDIyNVonJKYb0v0gIhCs4dLENBmzQaZi7N7fA4bsgktE6QVsABTBrXwpMKyAyJJvasLwtuBqjGcjAm/eIGN24fXKePK7sngq+ieSNalgMp3t5qgA6MIr93RDDYJ1MTWduaSz1q0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785040902; c=relaxed/simple; bh=kyGd78izF7DUIxRHpsyewhXGCUb6Jsi3bPLBZJEtxf4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bO21OthwNFFVDOaRQc70QCcOhfB2wxVPdK0MLaTlvj2WOsgHTcO3vtWfaRDv/aihzzKMbWu7M4p+XLUWM0BwcQLHKg7nktM5miUSAawUpHBM9us2d5KN/7ddDQAE/agWv18EcNhkzxTz4KzXPmTz3J6LQsbNrlI7mayBw9S4V1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=svF3X5gh; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="svF3X5gh" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-cbb662575d3so967497a12.0 for ; Sat, 25 Jul 2026 21:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785040900; x=1785645700; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=yJF2WM1XXyEqYRVgvX1/BaeT6htc22K6urn/DuogTt4=; b=svF3X5ghmnJROyIPTdk/V18dLFxXDaWYLQE6eHhGjrxmKG90kYTr8vgP1TwPXqTJNh +/RPICUGQ4U09MyYn/YKCgDQuivr/VWzuSei5J0pjQxKoONKZXKnNv1BX3MzSTJnIGKp z7SNQBZcYNI66tM4Ps5Yb+ThbvAkYr01ag273XddCDSNgpjmypgxQJ1yYw61XoelwsEZ KVRPiG+bt1mRYPMzvKJ+QzudyppQ+NY14VDYCAgpSTr9EzwmXZaQewOe4xTZTWH3Goon 2absWwGQ/treUt4Vl8YChFOhezcX5G8MVhoZQ16AD3HSHF8PSQbFogYrn8Q6r5BuV4Qm 6d5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785040900; x=1785645700; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yJF2WM1XXyEqYRVgvX1/BaeT6htc22K6urn/DuogTt4=; b=s5ZzUz5RC5wJ5pJ41U6+3QDQzfFUvS3g3tr0rqZJHWCaAZ2uTFWTv6VUnSzyRBHp9G BsauPA5bp1xwahiBm6Tqzsr2KkxjN34V2dO74XW2EtWPcs5OR6Npx1dU+ZAdvZp/jT91 98RrVQXT4L+RCtRC/+nRiTYL0vaIPjIFHk2qLx/7tLib3kMjqY2NKE6jClN6gWbyF2FW kYZVIB/pa4DWSbhiEHfe2eeq6O9J3Hp8Ta02PxAwz9GfX/ebfD72nde8kr0Msbx7lVbI PFlZLkSapMGn3pBK5hpIc4Lpc+9QF6eTWNy46w8HsYXtXz8Vm6KQnOGQLs3opfNu6T+P uS0w== X-Forwarded-Encrypted: i=1; AHgh+Rr68CDllZCXw96Q+ofiC9xt0HSKQzXflVWhONqe/tZv1X7hdgKE+9WJrzWBn8IZV4i4LrlkgyI2hcMzNbk=@vger.kernel.org X-Gm-Message-State: AOJu0YzGGO5c1Olj5OPjjyVKc5FVQgimeWSacaBdpb/+DNYaev/l3VRO EgRdjrgLefbf9QkrUdfGtPQLv0p1SuhsX0GD2nmWJpFPlDgmK+eGIpgw X-Gm-Gg: AR+sD11u6vk6wAQip624FVT+GYYsU0P/b6SgIt4ev1Aa9/kd+YSwYxf+yQZ54gXJqej IptE0NtF92QXSLLFsr8BjM7Cq1b688Up/wcR2sC8vudpu7eCM8r16dZJ88AhM6u+Ilpn+sw0U/M i24fJC79kjjD6dEZZEVUJhpi6aiNMlqyvm4N/NN0GyBh9BzT8b9BsYJ9dT5cvWcMRHiv28mYgm/ 5KFJXXBYRObte9GonigkUp4CFqvdkAhdKZXBaoi6k7/GEHXYdTk7WaWNAgFiaK/xzdR9Rb6GRXO rnk7EnivLt8NLnzWo60/tcAopeVP+gQCaS19e1U09PUpFRlelWm7D1gN515qSdQOBerTTg7Ilzm 0Ii8cqo1XzQVeOULj06rC5IABqvMm036pEck3H9nWdzc5U5uQsudat8XTfMbww3enL9VFsjm1mp JPogHt9hwEAxZIyKOI8F/5VddlgPGio2GiaayhrQC5BUehhr3yTE8diw== X-Received: by 2002:a05:6a21:6494:b0:3c3:9aff:7a5b with SMTP id adf61e73a8af0-3c67df803fbmr3581873637.50.1785040900193; Sat, 25 Jul 2026 21:41:40 -0700 (PDT) Received: from google.com ([2a00:79e0:2ebe:8:e2c2:1f24:32d5:9d51]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13d6ba579c3sm12943132c88.8.2026.07.25.21.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jul 2026 21:41:39 -0700 (PDT) Date: Sat, 25 Jul 2026 21:41:36 -0700 From: Dmitry Torokhov To: Liang Zhan Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] Input: tca8418_keypad - fix potential infinite loop and OOB access on invalid keycodes Message-ID: References: <93177ed2-10ca-40a0-9efc-95d83913e59b@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93177ed2-10ca-40a0-9efc-95d83913e59b@gmail.com> On Sat, Jul 25, 2026 at 04:09:47PM +0800, Liang Zhan wrote: > The current code checks the raw register value against zero to detect an > empty FIFO. However, the TCA8418 datasheet defines key code 0 as the > empty-FIFO condition. If the hardware returns garbage data, the loop may > never terminate and the extracted keycode can cause an out-of-bounds access > on keymap[]. > > Move the empty-FIFO check to operate on the extracted key code so that > the loop terminates correctly. Additionally, validate row/column indices > against the configured matrix dimensions before indexing into the > keymap array, skipping invalid events. Unfortunately your mailer line-wrapped the patch so it does not apply. Thanks. -- Dmitry