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=1796323985; b=UA45Bmod1yCpLF+9SX//OSpE15JmiMQoBCHnjz+EKz9kBROm5hskHoA9xhyVi2+5b46d UHHhNS57VYX/93qy1YyaQ9rIubRQsdCmRIXomhH6b3ZtKKzFRNAl+W4yWr6j307QjRocf velyWay+QjL1Fq+GsnFgEpunv5XhFg5j4npO0SlUcBa5YdwgbTb9Tw7S5MUgB1az/t4qJ zqXE4f5EIj1SVv7LqufAWXbY9I46Xz5ToB0sRNmocjXDzHgSdHHw/okVujTbGhD1QRCqT tED6NgzD9fWhLH/pOFqI26PJ7T7RAmz4AnDHskeTHgoIXe+IiJQsmsJlWfymkKiNTvQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796323985; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=zk88S4cZP5orVSOgKSOfwzhEzyh7/ZGHeLaciS9/ZQk=; b=3DsOqFy51/MN9Y70p87qt8SPHjiZx1d964Ogs3sJrNoH8ENlAnpt3I+FVMDs/yUBfqs8 m/yK9mulOUxBaOPYtu7+T6CHLxgldGyHwtoI3YGSB8ngEG7BIfjdq3hHkHE0epWiAyVEZ 6dO5Xpl+WhJqLtN/0B5kIkY1xa4jNXkc5cQ1lQrDxKO1tiokN7mRmpE0SxIDUhHgu1dPd 4t1dFgvf2/JQcBVbvYZG7JZHGz60WAO8N5g1HHaY1DXpJxXkKxObycZ5flT95439VATww yOjg0EfB+JYLfeetCMWJkrjQ+c+v3Vx7V5f+o8BmdcG+Qf+zK7pb8ETziZ3SsGeC7ig== 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="U+/zop5k"; 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 AAC0D606A32C for ; Thu, 3 Dec 2026 18:53:05 +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=U+/zop5k Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22E6D1F00893; Thu, 3 Dec 2026 18:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796323985; bh=zk88S4cZP5orVSOgKSOfwzhEzyh7/ZGHeLaciS9/ZQk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=U+/zop5k3QY9FadjeeR/NIZKaJ9ZhLIuj/HYF1ngHNN1+fmDwy48FBBU4A6Wjh43A Htd71urVaVw7rwLCd5/L2A38Z6QpV67LbREUzCKtyBGYHvIpyS3myK7PNeaiwNkIl0 qoZjOhPKCOG8TDTgmKeRLm0waZY5sATNK/zKaHNTJNnFErMeiwqEogyh3XpvwZGjSp kGBdMch0DKjnxnuM43G6ubjPjKD164RaQVkTgpR47P4gjUA9gCBIORxPdUwhNhOih9 QPRkiwAF0xKZZJXtWMBqRQEsp1vVxuPxzS2NMsdFLbcTVEkVi2tDcQbuGsc9HOWa8P C59tEO9IUhNlQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] HID: steelseries: Fix Arctis 7 battery reading 3% on overlapping requests Reply-To: sashiko-reviews@lists.linux.dev To: "Martin Oberleiter" Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com In-Reply-To: <20261203-arctis7-battery-v2-1-5ea29f516329@netixx.it> References: <20261203-arctis7-battery-v2-1-5ea29f516329@netixx.it> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 18:53:04 +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: steelseries: unlocked reinit_completion() races with complete() -- commit 237c0ec6e1bd62a83cc766060cfd1c8607a35320 Author: Martin Oberleiter HID: steelseries: Fix Arctis 7 battery reading 3% on overlapping requests This commit makes the Arctis 7 (2018) status poll wait on a completion for the 0x14 connection status reply before sending the 0x18 battery request, and skips the battery request if the headset is not connected or the reply times out. > diff --git a/drivers/hid/hid-steelseries-arctis.c b/drivers/hid/hid-steel= series-arctis.c > index df61fa33d4c68..7b83ff8a361bd 100644 > --- a/drivers/hid/hid-steelseries-arctis.c > +++ b/drivers/hid/hid-steelseries-arctis.c [ ... ] > @@ -101,16 +103,44 @@ static int steelseries_arctis_1_request_status(stru= ct hid_device *hdev) > return steelseries_send_output_report(hdev, data, sizeof(data)); > } > =20 > +#define STEELSERIES_ARCTIS_7_REPLY_TIMEOUT_MS 100 > + > static int steelseries_arctis_7_2018_request_status(struct hid_device *h= dev) > { > + struct steelseries_device *sd =3D hid_get_drvdata(hdev); > const u8 connection[] =3D { 0x06, 0x14 }; > const u8 battery[] =3D { 0x06, 0x18 }; > + unsigned long flags; > + bool connected; > int ret; > =20 > + reinit_completion(&sd->connection_reply); [Severity: Medium] Can reinit_completion(&sd->connection_reply) race with complete() in steelseries_arctis_7_2018_parse_status()? reinit_completion() performs an unlocked plain store (x->done =3D 0), while steelseries_arctis_raw_event() holds sd->lock and calls complete() on every incoming 0x06 0x14 report (for instance, a delayed reply arriving after a previous 100 ms timeout). complete() does a non-atomic read-modify-write on x->done under x->wait.lock: CPU0 (kworker) CPU1 () steelseries_arctis_7_2018_request_status() steelseries_arctis_raw_event() spin_lock_irqsave(&sd->lock, ...) ... -> parse_status() complete(&sd->connection_reply) load x->done reinit_completion(...) x->done =3D 0 <-- data race store x->done + 1 If complete() overwrites the zero reset with a stale non-zero count, wait_for_completion_timeout() returns immediately and sends the 0x18 battery request back-to-back with the 0x14 request, re-triggering the overlapping request issue. Wrapping reinit_completion(&sd->connection_reply) in sd->lock serializes it with complete() in steelseries_arctis_raw_event(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-arctis7-ba= ttery-v2-1-5ea29f516329@netixx.it?part=3D1