From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 AA8C633F399 for ; Wed, 5 Aug 2026 03:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785901597; cv=none; b=s+vENZO1UdI76wUiOwmZR67I3XJ6iYAaQcZWb6QBl02fzydmwH22uBmMma2ZwLeho3hJ1qqEp6QZEE8Fu+YNwBZwFbxt8fW4kJ1m+fsbSmCTiMjGIs9WvFQMtE0WCJYpgyAQ8zXrItASoEfaCSbOtKIfvEY7kJn+/wjBr2KPCy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785901597; c=relaxed/simple; bh=V6L1uncpNDG98/tPMbvHYCKcGDxXRUFDU72MczzTRg4=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=CApbrrbeiwJEEtT32JK6RiwuJ6j8fIrJCWEXVkChFoonO7HVgDgTvyeVGrJ5ZmtnXjkUsOWlGUId5+dxKvzrGBGuM2Fo3ihxyjJfG7FuF9AXYHQKuqSnuDRuTsu+XidhQ3o9TT3v9da5bti6+b4y90zoQSqvHsSSTS2406ahwzA= 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=kDNB3oM3; arc=none smtp.client-ip=209.85.215.181 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="kDNB3oM3" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-c9eefcf9175so412756a12.3 for ; Tue, 04 Aug 2026 20:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785901595; x=1786506395; darn=vger.kernel.org; h=content-disposition:content-type:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HlIEXTNcuCEiC7E3Thba2FVlKyMKDVKx24jQHuFwaPY=; b=kDNB3oM39dxTvBKUCXuzLvfWPEK1vcCyjFnOGqDU8ptU0ub0SeNlaLAV+t23vs+h19 5ASStYpWTMGy4+PYzOh0AYeh69Xg/Ab8Zdm0QRL8FzrTTqxEh5YD5Uzv4C8VsT9NeJsH bi5qTW6ZPEp/8ncJ3Lr/95uw4o4+w+cQZ2jmR+A9G+hTpronOq5IwE//CF0hRzRpMCSi X6k2MNqCZN4qk9s3FkdoE06VKzmvI6x6tHctpZM/4E+DwKlseQKQvH9MLvZZaTbs7M5s GC6BNQE6JUscZ2tBNR430bV5uBifLPYiljZdXZPSCDZeomfE/RoeuCAcsxZMBx8U2AiN yqHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785901595; x=1786506395; h=content-disposition:content-type:mime-version: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=HlIEXTNcuCEiC7E3Thba2FVlKyMKDVKx24jQHuFwaPY=; b=qW+G0uNMJ9IbOPG35M+DliXBBwnZnushQCweqI3DbFSUUaT1hUz/C0j05NNzmgoKOd tKTJz1UeZ//yecqfya2tPm5hRFEmdgArg38OnCMvU4aBmEWbDWN73yhEt172FpuMHaYf UbolYkW8QbLfz0mPShnsvEu6g0pcSgs9ye8ofJQCpV//Gq7D6b9bP2TPVUSGQM7wvCqG 9L20bTEQInkJggucak6xCR8GROu7/TGikWXRF1y055i0MWumxmb8rkGsBRY/5Q6/chdz WV9MkXDw6op4ClGtOxXUUrlZXAo6gnsl+N9GucYsRDGdA5qbIUmN3Y/6k6vAI8Lof9Dx o3jA== X-Forwarded-Encrypted: i=1; AHgh+Rrj5UsFZFk4lnaph9jLyAGE0Dioph3zlYULb04UFWsXH905J3tsz2uoIocb/RAlXCqzWyxAleZSES60vGM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2TpvSf+TVm2Caj5lMK8ojaTLEKOJIYVXEps9rKgfRgielY5u/ Jmu+G6rY59/7tn0o8DWcrH7Xb+nb5wiM+Jm/GuczW9oqMGTXjRCzZvrs X-Gm-Gg: AR+sD12QcFg3ChzpzfydU7MMnorvfGK3PkBoxB3mBXn4I9oUGYMQsi/09WyZl8aCYr7 hRgufsPDhqWTjq6/xs+uasdxQ6EoUgqqA5hSe1FmFKcMQsz9hAOy51k1tYBza5KoczXLXsTvrhM yZVs8jMRKnyxFoF6819YzfFU528DyH6rU8jCGkO4TANJAjceqyjaVyyCbCCnqqJDBMrHCzxfd8Q HUXkBP6slgVsaR+0ng9+wYyy1a+I8fo+ApaA7nNufGMc4krWkjE6wDiDKPDmbX1vOeIX9z0a2Z9 s6RJ9889aZDcFw28bQtqcy9LaAHRXG8rvaJy2gZM2hhrSBQiOl6oYspjJBy7bo/t0qBzRLgGqdV DumQ4F0e+sOGvvuq9VvApduFgqEZaDWwNCTJALTux6Anpr0L8q+6+2Vh3EnmXHvGtnyZCPW2pgb BhbKXATbu9NShP4jwoSPjtVHRl4+G5I/01nsQulnLO1IChTf9xqtNo8JEklGltAC99REdmYmN+9 zWCbqG/CimVaoaMzeLW+NqEqLzGEQ== X-Received: by 2002:a05:6a20:d38f:b0:3c3:935a:af2c with SMTP id adf61e73a8af0-3cb85dcc9abmr4374382637.3.1785901594913; Tue, 04 Aug 2026 20:46:34 -0700 (PDT) Received: from google.com ([2a00:79e0:2ebe:8:bf3a:ac93:79c4:84fd]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca50acddsm8987014c88.3.2026.08.04.20.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2026 20:46:34 -0700 (PDT) Date: Tue, 4 Aug 2026 20:46:31 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Bryam Vargas , linux-kernel@vger.kernel.org Subject: [PATCH] Input: mms114 - fix touch slot corruption in suspend Message-ID: 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 mms114_suspend, the driver synthesizes touch release events for all slots and calls input_sync before disabling the hardware interrupt via mms114_stop. Because the threaded interrupt handler runs independently and does not share a lock with this early part of the suspend path, an incoming hardware interrupt can fire after input_sync completes but before disable_irq is invoked. If a touch event arrives during this window, the interrupt handler reports the touch slot as active again, overwriting the synthetic release event right before the system goes to sleep. Upon resume, lifting the finger does not generate a release interrupt, potentially leaving userspace with a stuck active touch slot. Fix this race by calling mms114_stop, which disables the IRQ and synchronizes with any executing interrupt handler, before synthesizing the touch release events. Also ensure that we only synthesize touch release events if the input device is enabled, keeping the entire suspend sequence protected by input_dev->mutex. Reported-by: sashiko-bot@kernel.org Assisted-by: Antigravity:gemini-3.6-flash Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/mms114.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 27911a9f4e9e..734c37579f5a 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -679,6 +679,13 @@ static int mms114_suspend(struct device *dev) struct input_dev *input_dev = data->input_dev; int id; + guard(mutex)(&input_dev->mutex); + + if (!input_device_enabled(input_dev)) + return 0; + + mms114_stop(data); + /* Release all touch */ for (id = 0; id < MMS114_MAX_TOUCH; id++) { input_mt_slot(input_dev, id); @@ -688,11 +695,6 @@ static int mms114_suspend(struct device *dev) input_mt_report_pointer_emulation(input_dev, true); input_sync(input_dev); - guard(mutex)(&input_dev->mutex); - - if (input_device_enabled(input_dev)) - mms114_stop(data); - return 0; } -- 2.55.0.571.g244d577d93-goog -- Dmitry