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=1796385888; b=tGnTWBCkwcKDdruscTF+aPOkodrPLJ/5VwK+4AVadm4O32r9lgI6TVVYwAN3kh+oTsO1 966h4PJeFgc8cvirH4pXZjGPhBppKwwCiZQedU3CIXTYDbsb+f83Z7iRH8dUybkOA/Rfx Sf6TF1oHEbwgeQ4mfpUWtFysrR1LlCj6WzKuTNkkz8FnK6CdS1sfDGFmlDI+ja5On6vX5 6lRn6SMiNIcWnQ6VXEUv4UmWhzrGVPXmhmZ101NcEizjE3GkUzt5JuYyYXv65OzhSBMNx Ui4m3YGF2l8/IvP9Ues2tT47L0lqgusRsF/+Gn1uv/83InKBNxLrfT6NOOMv/4htRWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385888; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=5x1rnWGzcuOKhUrX4R9jLNRNr3Qzfj0Xb2BdMIwAjPM=; b=qJhn9nuW4ihhuBUgC14EnXl/u13jNtnWdflzkbwdwwA2RyuU1u5bI+/993OeOJd3fHKC CgC3BRiPB8wKEgweQoOSKenr+LjOgCoOuoja85VrERuZEdTqovhBY7Oi8SKM/QxrrT8pu gqP+oHICVO6BzGbV3ptGzMWbgW/r+Kb0//tap2DzqngZFA56k1fjk7bWG0tV+fCap6llv wtLdMLkwEQRpG78DcrEYdMR48QuvQCyp31w2WCQna8dTvensjKCsUTO/aeOgASBGKzfb9 TZ4izToCzJpnZ6bwVi51CZAft49GdMPLhxnjaoazBt0/T3XMz8xFQ7H1Lj4yXN8MfIA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=lgKeRzRV; 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 BA2A3606A33A; Fri, 4 Dec 2026 12:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=lgKeRzRV Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD3D21F000C2; Fri, 4 Dec 2026 12:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385888; bh=5x1rnWGzcuOKhUrX4R9jLNRNr3Qzfj0Xb2BdMIwAjPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lgKeRzRVMRN1UV8/WyqdZ0be8zJIuaT03bCbOZ7ALXbjdBnk4Vd6ZeLCWhVz3r0J9 D5OTx18R57AQA7sCpxqcgsgzy2GEUk2Rv2Vo6I0P8+tDwFOpMh9KcFbjezE979zmvr HwRKrz8GS3H0rkMrSnagbxdD2dYW9I1a+Wh8PlAs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrew Davison , Takashi Iwai , Sasha Levin Subject: [PATCH 6.6 0735/1167] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set Date: Fri, 4 Dec 2026 19:02:42 +0900 Message-ID: <20261204100721.216562734@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Davison [ Upstream commit fda103c1432f344e1cd548f346d157b1e67ee7c5 ] parse_codec_mode() reads the vendor and subsystem IDs of a patch file's [codec] line into an int, and skips the check when the value is zero or negative, as documented. An ID with bit 31 set, such as SigmaTel's 0x8384xxxx or Intel's 0x8086xxxx, comes out negative, so it is taken as a wildcard and the section is applied to every codec instead of the one it names. This was seen on an OpenPeak OpenFrame 2 with an IDT 92HD75B2X5 (0x111d7608). A patch file written for the STAC9202 (0x83847632) in the related OpenFrame 1 was applied to it, swapping the headphone and speaker pin configurations, so auto-mute never muted the speaker. Read the IDs as long long, so real IDs are compared exactly. Values written as negative numbers (e.g. -1) still act as wildcards, as documented; a hex value such as 0xffffffff is now compared as written. Tested on 6.18.60 on an OpenFrame 2, with a rebuilt snd-hda-codec and the STAC9202 patch file: user_pin_configs stays empty for the IDT codec, and the headphone and line-out pins are assigned as the BIOS sets them. Not tested on a STAC9202 itself. The bug was tracked down and this fix written with an AI coding assistant (Claude Code, Claude Opus 5.5), which also ran the tests above. I have reviewed the change and the tests. Fixes: ef940b0403d4 ("ALSA: hda - Allow patching with any vendor/subsystem ids") Cc: stable@vger.kernel.org Signed-off-by: Andrew Davison Link: https://patch.msgid.link/20261106175518.18629-1-andy@dvsn.net Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_sysfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c index bd3686d60555e..25fe3ac2c0389 100644 --- a/sound/pci/hda/hda_sysfs.c +++ b/sound/pci/hda/hda_sysfs.c @@ -522,11 +522,12 @@ static inline int strmatch(const char *a, const char *b) static void parse_codec_mode(char *buf, struct hda_bus *bus, struct hda_codec **codecp) { - int vendorid, subid, caddr; + long long vendorid, subid; + int caddr; struct hda_codec *codec; *codecp = NULL; - if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) { + if (sscanf(buf, "%lli %lli %i", &vendorid, &subid, &caddr) == 3) { list_for_each_codec(codec, bus) { if ((vendorid <= 0 || codec->core.vendor_id == vendorid) && (subid <= 0 || codec->core.subsystem_id == subid) && -- 2.53.0