From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796144239; b=dNwPJIhu7K84vv7jeDEpb6P3F7HYfuek7Tix3VTYqRJ/no7MCQMGCkLDpAlggnCAtsLh chEcW61IgtCjvtSrR4g7d9BXTtYslx7rS5pZWC6StlrZtRGHN4nXmWbiPOIJ7I11IOayl MxA/7lN5jXPpnZX+rgPuo3klR8w/L1snUhc3kQzPeWb2SOgRr3pxWz2ZZxTvZvKXTShce PQsHIiiZRRsWoR4dPl5YAasLECm0mAko8vvDbZ3IyqI7p1ciyjJqG1sGB6LbE8VjLlK/9 9+3iPP8n3extIArXw4gM4ouL4oSMBV3CgGMcgSJKM4d4fd+0/SmWppJD+45+vTA72KQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796144239; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=XcXgpQHShvhD4wHvbu5mu8QWwM7+U4Z1VtLkII/IpT8=; b=H80jv705pqsin8GR6OL1RQuF+wSjm9N9OkHGBwVLFYf0FW9doUA5qsP6MonyqlczMBui YjUip9lSJ3odsB4DqHifDNffCPi7Nwfj4I7rFjmExW7Gm91xLVrsZ3wYwGvl2SLcT/aYb 5sJjNt73mSDZIUn9lABqOQ1QtD45UcLPOHw2MiqhN4wTunetShGpzZID+RtsVMEG7tgjQ FlSZeXwp3cZkj8ILMe8Gz0Jo4+X6TE8HNd5b10ORTFFw6m5MZQ1IOuGrPArl46SAaqUJI 6eMb+TLk17X/jYjdNor9lusYu8uQX2EhoQMTBOnLuKEzzeeLqOGV2wNr6HRG6CVAmiA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FH7H5FeO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B827606A31A for ; Tue, 1 Dec 2026 16:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FH7H5FeO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91DF81F0089B; Tue, 1 Dec 2026 16:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796144238; bh=XcXgpQHShvhD4wHvbu5mu8QWwM7+U4Z1VtLkII/IpT8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FH7H5FeOhQuyfoGmR2kGwKGH9r2ARg0ZvP5tnf4XfDVEgCu/reEQ57I5VvmHQKCFv iMJejJS5+ZDPvyyktCxHGsSK4E4RkyXflT7OLI4ci0UL05ZtHe+mZeo4lfmjiNgC6H bIAy/YlUKOMc2EEa2wfUUt0uxIHSXxT46sdALP7GfXMFVS8Nwbe6D034JvzxmoxZXw GFFANNmU4RH6Oyrw9HPccRgIAyFJvj5dGTJmyfuFaHkwBad6tUx5eSgimRtS7RF2kF Hob93coEK9ZI/MMHm9/BHy4lSfbmM4bQv9gJYra2I6KBWQV468m/ZQSOfAf8SYST8J 7g4p4+w0YdByg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4] HID: hid-msi: Guard against delayed 0x06 MCU ACKs Reply-To: sashiko-reviews@lists.linux.dev To: "Kenhou Iijima" Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com In-Reply-To: <20261201164931.12935-1-kenhou@kenhou.net> References: <20261201164931.12935-1-kenhou@kenhou.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 16:57:17 +0000 X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] HID: hid-msi: double volatile jiffies read in claw_ack_window_remaining() -- commit 7768c8b350e8e88673d311b6a516c536e5724746 Author: Kenhou Iijima HID: hid-msi: Guard against delayed 0x06 MCU ACKs This commit restricts generic 0x06 ACK completion to WRITE_PROFILE_DATA and tracks quiet windows after timeout-0 commands and SYNC_TO_ROM so delayed ACKs cannot complete subsequent commands early. > diff --git a/drivers/hid/hid-msi.c b/drivers/hid/hid-msi.c > index 23d731f700c90..9614f708b14b9 100644 > --- a/drivers/hid/hid-msi.c > +++ b/drivers/hid/hid-msi.c [ ... ] > @@ -486,6 +493,30 @@ static int claw_profile_event(struct claw_drvdata *d= rvdata, struct claw_command_ > return 0; > } > =20 > +static unsigned long claw_ack_window_remaining(struct claw_drvdata *drvd= ata, > + bool *pending, unsigned long until) > +{ > + lockdep_assert_held(&drvdata->cmd_lock); > + > + if (!*pending) > + return 0; > + > + if (time_before(jiffies, until)) > + return until - jiffies; > + > + *pending =3D false; > + return 0; > +} [Severity: Medium] Can jiffies advance on another CPU between time_before(jiffies, until) and until - jiffies? Because jiffies is volatile, the compiler emits two loads. If jiffies reaches until on the second load, claw_ack_window_remaining() returns 0 without clearing *pending; if it advances past until (for example during a multi-tick NO_HZ catchup or vCPU preemption), until - jiffies underflows and causes __claw_hw_output_report() or claw_hw_output_report() to sleep for a huge timeout while holding cfg_mutex or rom_mutex. Snapshotting jiffies into a local variable once avoids both. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201164931.1293= 5-1-kenhou@kenhou.net?part=3D1