From nobody Fri Jul 24 04:48:30 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 0338118C2C for ; Fri, 24 Jul 2026 00:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784851739; cv=none; b=Pka/emyEgvc9ofHuSYVqd2MlC43x825MyY4cVAXLEikXjXlezOg4mbtwDRYxh6cJ4oQ8QUkbtpJuiz8aXA3NuHm+yBGqpla/vvKTZB+J6grScTjdluUHP8EfYbJ2obl5CC3XwqTUazAqQxjosYNfCC8z/Oms2lv8P06trqzR99A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784851739; c=relaxed/simple; bh=OF4euTvz9Hql8JYKKoh5biNS8RtwKAs/ME/rZeYZvqU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BaizDQV3LoVuO0BmBsr1NB5nZzN9QRyvuTpfmQacfzVL4FGFhdFeg0uNEZ8eLMZ+OrNHpgq+0CS+YyqhL+qPcCvJly4/KFhm6/o1L5wGRxn+nUwl+YFU4ozQASponf1kXl6L204kzU0leFt2k/YChOt1UvqsyqTR4g/mw6RMdhk= 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=qPw0FSQB; arc=none smtp.client-ip=209.85.128.48 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="qPw0FSQB" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4956242332dso9869005e9.2 for ; Thu, 23 Jul 2026 17:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784851736; x=1785456536; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=nZEegZeal7l4AtR9CR5NVf2WTYyHtR0C/RY7KRHJhyg=; b=qPw0FSQBUhpNwglGQqX4CFE2SwjdBbxjCTI5It/fhtTEQLNRw5THmZBWx/FMkpsvC8 THnD6Rc2F1Gblurd2ot2Gab8ErbcvfUJYlo9eTafyIcmLH7/UaPKrcrlB9zKXd9fZrWC E67F6Az+87yGE/mpYMQxA7Z4sAw2MfYK7bg9ylk7zE/DJVQONC9DVK5wXK754TYe2N7q RtYzfPG8NdT1BE2HphMxuHUaa5FK5KcasC9LIvAm2yWuSNlQVFy2rywGdG8wox7sOR9h wc+5Fj1OxAwvpMNlWbllzIqPD1kLnuPFzRkzMRBQflm8Cpn6mwLlqoEEanuhKTHDbxdt 5yWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784851736; x=1785456536; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=nZEegZeal7l4AtR9CR5NVf2WTYyHtR0C/RY7KRHJhyg=; b=dS9RLaGT953XOw3P8Mj+1XsHjJPxhvbHn3sBVDU+LoWQuXq+VeAXaPKVHMFGgvxmP6 kMD97zs4zPIqVBCA+SwDu1AkPCxIsLKW3mHtopCdk443YwCQ5S6b2oLuh/EXlAJVw5/W +NbYMnoSnNTH4drxji7OyZvmPML7tzbTOXu95oJHXxBV59yhUrQjUy377eUhIKDWUakQ RE+ojo/itHML8ze9fMVW/ujsqV3mABZq4xE9c+NkqYYjILtuNOOQk2G7I/skhrEgQQt3 AhhpMiBlAqY+wyZ3D34/8PLV4fcVNXkdWgo4aFco2Tbid6//Y2qQwptg4NIJCInTtNlj uLDQ== X-Forwarded-Encrypted: i=1; AHgh+RqCaGMWr0Do97oOb6BgzhFx2pdgnVguEnb4iBD87ZUEDtXkaAHK3GV4WiDtan4AWcgN0FGakiRhY+qroO4=@vger.kernel.org X-Gm-Message-State: AOJu0YwCd1U9KgbT8NnhKa3FqdmtfLkyFb/cH2jNnQCxpKCzDwEOYODj Cfybc+iABL//1l3S7+tMC+SOwalfm0beFH++k9ledY7lJZX95JxEpATr X-Gm-Gg: AR+sD10X5HJoOg7ISAegUVCIoQGQnvE1pHbPUmZubvfbT6NRhY860mAnjvZajqp0w/e orc7QQUc3Mel+bgsHyzGrPghfVpzHKbqgUxrLFr4nXZl2StUTBhgnWGoaD/bacCZS0Au/8oCFX0 DvqhByufRm+s+OwS6d8Of3gewdAnRW9FF0hzyYSYRzC4YXNy8OvWVtJfrUA2E3+D+ynVEJbd/9z 2T9uFfiDRf9s8Z6/P0hePGXcukzF+wy9VfVyBZaby+A1PhYP1coAVIKCPA09pIxklAgUgkX89lL fM6/Wc1+E8fNI533zX6z0wXj8KhNK1MuRfjUNveRiYofKsinbJXGK7AKUQ5nGH8zk5ONOu6xt01 AvpqxwWV6PjQAC0hcjlQ31Yk8HjMvdHSxlLfPYVs0aEo0wow6JuhVNf0Pum1qxdyhofdJTevFNQ == X-Received: by 2002:a05:600c:6012:b0:495:4d2d:82f2 with SMTP id 5b1f17b1804b1-49573d0eb3emr41533275e9.26.1784851736063; Thu, 23 Jul 2026 17:08:56 -0700 (PDT) Received: from beelink.. ([186.247.163.143]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4957afb4da8sm24786345e9.12.2026.07.23.17.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 17:08:54 -0700 (PDT) From: Aldo Ariel Panzardo To: linux-input@vger.kernel.org Cc: jikos@kernel.org, bentiss@kernel.org, linux-kernel@vger.kernel.org, Aldo Ariel Panzardo , stable@vger.kernel.org, Sashiko AI review Subject: [PATCH] HID: multitouch: keep MT_IO_FLAGS_RUNNING inside the flags word Date: Thu, 23 Jul 2026 21:08:41 -0300 Message-ID: <20260724000841.933327-1-qwe.aldo@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" MT_IO_FLAGS_RUNNING is bit 32 of td->mt_io_flags, which is a single unsigned long. On 32-bit architectures a long is 32 bits wide, so the valid bit indices are 0-31 and bit 32 falls in the next word. Both users take and release the flag with atomic bitops: test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); so on a 32-bit build every report and every sticky-finger timer expiry reads and writes the four bytes that follow mt_io_flags in struct mt_device -- inputmode_value, maxcontacts and the is_* flags -- instead of the flags word itself. Before commit 46f781e0d151 ("HID: multitouch: fix sticky fingers") the flag was bit 0 and the word only had to hold three flags. That commit reserved the low eight bits for per-slot state (MT_IO_SLOTS_MASK) and moved the flag out to bit 32, one word too far on 32-bit builds. Put it at MT_IO_SLOTS_BITS, the first bit above the reserved slot range. The value is only ever used as a bit index, so nothing else has to change. Fixes: 46f781e0d151 ("HID: multitouch: fix sticky fingers") Cc: stable@vger.kernel.org Reported-by: Sashiko AI review Closes: https://sashiko.dev/#/patchset/20260723224211.613112-1-you@example.= com?part=3D1 Signed-off-by: Aldo Ariel Panzardo --- This applies on top of "HID: multitouch: bound the slot index before touching mt_io_flags", which introduces MT_IO_SLOTS_BITS. The two are separate defects with the same Fixes: tag, so they should backport together. drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index a75c821f7758..e7d811ed4123 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -99,7 +99,7 @@ enum report_mode { =20 #define MT_IO_SLOTS_MASK GENMASK(7, 0) /* reserve first 8 bits for slot t= racking */ #define MT_IO_SLOTS_BITS 8 /* bits covered by MT_IO_SLOTS_MASK */ -#define MT_IO_FLAGS_RUNNING 32 +#define MT_IO_FLAGS_RUNNING MT_IO_SLOTS_BITS =20 static const bool mtrue =3D true; /* default for true */ static const bool mfalse; /* default for false */ --=20 2.43.0