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=1796372015; b=EXhhkdqOdPL0gliAPnml4eo7zuK8LK+ARHNKeua6xHF2qvHKZDiGu6jTvAs1AJ+O2hi+ uHasebHiubceOPm9O3ajmBrSeaRPzyIDYV3wEalIi7byMLrvARu/1HCQ5OgkkP6HYs67d HxqLblz0opZ9hrJuNC4zLXfISgTIdG89aZMu5SYN2Wu+YpwtbVr66xQkdr3EU9tJM+VMc Qc2/YbR5Etk4h2/2jxk6X5aq40QdljR5w/PMpnI4yzK6W/alsboQ+TH0KclGkp/lO6IHC Uh8+XcOYYzs/nhWbOZtPA2AdxxKYqSSnPYDfXzDapPl4ptRdjKHjGEcUmTlXwsB9ugw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796372015; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=oqNSsSKZeQoLlKKwilPltblKNbdPdpfMkecA1yIk6Vs=; b=ekQ10DnJACurTQKZ6ZSx04CAqQrS6Y+eFb+0fgILrSO63/lcETdXjwlM2HqJRgbHMyP8 gJ0M81gkJY/q+ltGtcmVLmcMBv04jq4eectMwfpI6qXyVfyx3ioBkRBK23ieK5QHNHzDs deKXg6SGp/nnuPojTYY3IRUxz3Oq1rOeomMe+gAbWcSBLLVm2Ya4IgPgWE5LVSUJ/r9Kv VlfykDhjbCOu72JsV8N4XUpeeaZH08QQm3bOhsGlyW/dU6lmxZQvr3c01nmBNzgPITvT5 INTCR7NnAvUASXidxslKrZT6icWszMA3J9ZfIrPJE+kzZVxbQeq5MpJksxlhAa0/XTg== 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=isNPPwmL; 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 16A8A606A322 for ; Fri, 4 Dec 2026 08:13:34 +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=isNPPwmL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89C571F000C2; Fri, 4 Dec 2026 08:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796372014; bh=oqNSsSKZeQoLlKKwilPltblKNbdPdpfMkecA1yIk6Vs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=isNPPwmLvbMjnXwU7WzrY2G1pLrIrh8vWLc9gVE10QfVd96zkLGDtH6ITL7991kxd xllpI+gVCOeCTAkeBw+iu1sDClwDTPCDRPPEee+oqCIcpXpQg8Y16Bqzns7isZAC3Q qObD4imZ/DC3QReJBiWjR09zwNJQyC5Z2o1hcZWzzeNqcIQFTYqpPBg3X7ni0n/y4m 87UiNF/At0CCMWWyw/PjJiGjWWn6FEZ6NHykJul4iCi6lI34bSjs7RW2T/QSsI2Ztx EwAp8UWmcNVNz1C0oJcMfh0aqdRHXYJTmasVv9IHEV7vf6Hmt4JnofbUkndxA2ULQC h+Z0UkaA3dE+w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] ALSA: hda: Reset jack_detect on failure Reply-To: sashiko-reviews@lists.linux.dev To: "Sreeraj S Kurup" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261204074922.2913-1-sreekuttan2156239@gmail.com> References: <20261204074922.2913-1-sreekuttan2156239@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 08:13:34 +0000 X-Mailing-List: linux-sound@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 2 potential issues to consider: - [Medium] ALSA: hda: unlocked hda_jack_tbl bitfield race on jack_detect reset - [Low] ALSA: hda: missing Fixes trailer for jack_detect error reset -- commit 0d601e39d22a878d7df0b6f309b26383e1690de7 Author: Sreeraj S Kurup > ALSA: hda: Reset jack_detect on failure > > Reset jack_detect to 0 when enabling jack > detection fails. > > This allows a later call to try enabling > jack detection again. > > Signed-off-by: Sreeraj S Kurup [Severity: Low] This looks like a bug fix for leaving jack_detect set after a failed verb write. Should this include: Fixes: 01a61e12b460 ("ALSA: hda - Create jack-detection kcontrols") > diff --git a/sound/hda/common/jack.c b/sound/hda/common/jack.c > index 6b8aa1a6c0084..9fda0bdd97e93 100644 > --- a/sound/hda/common/jack.c > +++ b/sound/hda/common/jack.c > @@ -364,8 +364,10 @@ snd_hda_jack_detect_enable_callback_mst(struct hda_c= odec *codec, hda_nid_t nid, > err =3D snd_hda_codec_write_cache(codec, nid, 0, > AC_VERB_SET_UNSOLICITED_ENABLE, > AC_USRSP_EN | jack->tag); > - if (err < 0) > + if (err < 0) { > + jack->jack_detect =3D 0; > return ERR_PTR(err); > + } > return callback; > } > EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback_mst); [Severity: Medium] Can resetting jack->jack_detect here introduce a data race with concurrent jack->jack_dirty updates? In struct hda_jack_tbl, jack_detect and jack_dirty share the same unsigned int bitfield word with no lock protecting it. Before this patch, jack->jack_detect was set once during probe before codec registration and never cleared. Resetting it on failure allows later runtime resumes on codecs that ignore the return value (such as simplehdmi or DP-MST generic HDMI) to re-enter snd_hda_jack_detect_enable_callback_mst() while bus->unsol_work is active, since hda_codec_unsol_event() only filters events during system sleep. CPU0 (runtime resume) CPU1 (bus->unsol_work) hda_call_codec_resume() snd_hda_hdmi_simple_init() ... hda_codec_unsol_event() snd_hda_hdmi_simple_unsol_event() snd_hda_jack_set_dirty_all() jack->jack_detect =3D 0; jack->jack_dirty =3D 1; <-- data r= ace An interleaved read-modify-write can lose a jack->jack_dirty update, causing jack_detect_update() to skip reading pin sense and drop a hotplug event, or clobber jack->jack_detect. Separating jack_detect from the bitfield word or locking struct hda_jack_tbl flag updates would avoid this. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204074922.2913= -1-sreekuttan2156239@gmail.com?part=3D1