From nobody Mon Feb 9 12:28:44 2026 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (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 31C3D31985C for ; Mon, 2 Feb 2026 22:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770069751; cv=none; b=mv3fo/Z2KbH+9Ibn4s+4Jmsjv7LRXG9wWbTFC8AXpdWqEzuKaUEmzl6xhA0UEtVznCJYHUIkrqUGvToWMtp4HsmU26R0oQYR4vPagdW+8LvthmsGjGjLWb4P68JosFx0Fnyh4WuLTz6pilzbdNlk1SiWmtNntSPT9qBrScul5vA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770069751; c=relaxed/simple; bh=M1h6oiDlaxrkqzOOKY7/+kSWhTgWeNiRMhUv+LJSN/g=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=pIImgjFYf1p2HAzbPl3s/kNg1bBU3g3VN+f7ZQxAoQFJTxk3yiFuYfIqLp9V7+s2PdcPif7iHjVqmtwn3v7+2B7YuVUBIv6wznfVdskIYkC3HZEtuq4vVAaHsSz5ooDBsma2aTJgveZ4UulqmEyBp3F+m+Nq2bYL456t3M2v2gc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu; spf=pass smtp.mailfrom=u.northwestern.edu; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b=rmVP9nqw; arc=none smtp.client-ip=209.85.167.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b="rmVP9nqw" Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-45f053b7b90so3267872b6e.0 for ; Mon, 02 Feb 2026 14:02:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u-northwestern-edu.20230601.gappssmtp.com; s=20230601; t=1770069748; x=1770674548; 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; bh=7SYQe/eEo0kQQumf8hsyNZeV4cvUpi1AJXZkoNU8kt8=; b=rmVP9nqwhvHBWj4MoJZc7nGZZCefCGx+gfNyLlt5r16IzS4NfZlF4VaEzdsBie7TP6 nq7xQEPlDGxa1x3Hc0O1jyhxpfeT88pPA2s/QX5u5TQZsquDw2XoLMsbyztsGHguzt3u FsJjyC0WfPgJfx9vCHCMMe85OcRHi0CJEtE6ONS8X8Ux0B5mCLdlSDkYYsW9VaqQPbTu C6SqvBkiPVuwrHBZjoWeskPRgWuB6ezrYzIEbTybYcmPO7CvFTU23BvERA4fZLWui97D m++euP8Lc2yBwf75QZjXvQQ2i+4tTyTmigOxx7xamFqyJQJvPzjo5ipSTkcvkAd9pv/R aelw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770069748; x=1770674548; 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; bh=7SYQe/eEo0kQQumf8hsyNZeV4cvUpi1AJXZkoNU8kt8=; b=elDfVhasFnWs/2yLQrf3Km9ecxOCCMygvPGoi73DvhzYArXew6RwZuZ/gn/TKB9EQW flKrRhkH540hywtZBVFSV5Df2NenWt1uH/z805w36RgTUrUVyf6wJFSUKFR1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:c413:b0:45e:a76d:966d with SMTP id 5614622812f47-45f34d178fdmr8095640b6e.45.1770069747944; Mon, 02 Feb 2026 14:02:27 -0800 (PST) Received: from security.cs.northwestern.edu (security.cs.northwestern.edu. [165.124.184.136]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-409575f6551sm12422161fac.22.2026.02.02.14.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 14:02:27 -0800 (PST) From: Ziyi Guo To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Ziyi Guo Subject: [PATCH] Input: cyapa - fix missing input->mutex when calling input_device_enabled() Date: Mon, 2 Feb 2026 22:02:23 +0000 Message-Id: <20260202220223.2471730-1-n7l8m4@u.northwestern.edu> X-Mailer: git-send-email 2.34.1 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" cyapa_enable_irq_for_cmd()/cyapa_disable_irq_for_cmd() and cyapa_reinitialize call input_device_enabled() without holding input->mutex. However, input_device_enabled() has lockdep_assert_held(&dev->mutex). Add mutex_lock()/mutex_unlock() around the input_device_enabled() call to properly protect access to the input device state. Signed-off-by: Ziyi Guo --- drivers/input/mouse/cyapa.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 00c87c0532a6..e5fe3b8b6548 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -525,8 +525,15 @@ static int cyapa_create_input_dev(struct cyapa *cyapa) static void cyapa_enable_irq_for_cmd(struct cyapa *cyapa) { struct input_dev *input =3D cyapa->input; + bool input_enabled =3D false; =20 - if (!input || !input_device_enabled(input)) { + if (input) { + mutex_lock(&input->mutex); + input_enabled =3D input_device_enabled(input); + mutex_unlock(&input->mutex); + } + + if (!input || !input_enabled) { /* * When input is NULL, TP must be in deep sleep mode. * In this mode, later non-power I2C command will always failed @@ -545,8 +552,15 @@ static void cyapa_enable_irq_for_cmd(struct cyapa *cya= pa) static void cyapa_disable_irq_for_cmd(struct cyapa *cyapa) { struct input_dev *input =3D cyapa->input; + bool input_enabled =3D false; + + if (input) { + mutex_lock(&input->mutex); + input_enabled =3D input_device_enabled(input); + mutex_unlock(&input->mutex); + } =20 - if (!input || !input_device_enabled(input)) { + if (!input || !input_enabled) { if (cyapa->gen >=3D CYAPA_GEN5) disable_irq(cyapa->client->irq); if (!input || cyapa->operational) @@ -628,6 +642,7 @@ static int cyapa_reinitialize(struct cyapa *cyapa) { struct device *dev =3D &cyapa->client->dev; struct input_dev *input =3D cyapa->input; + bool input_enabled =3D false; int error; =20 if (pm_runtime_enabled(dev)) @@ -652,7 +667,13 @@ static int cyapa_reinitialize(struct cyapa *cyapa) } =20 out: - if (!input || !input_device_enabled(input)) { + if (input) { + mutex_lock(&input->mutex); + input_enabled =3D input_device_enabled(input); + mutex_unlock(&input->mutex); + } + + if (!input || !input_enabled) { /* Reset to power OFF state to save power when no user open. */ if (cyapa->operational) cyapa->ops->set_power_mode(cyapa, --=20 2.34.1