From nobody Mon Sep 28 02:57:19 2026 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 82E9C3DDAE9 for ; Thu, 27 Aug 2026 23:21:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872914; cv=none; b=upPSp6+ynf2TCgT8kT+1NRATwW4CrtxULLPlyUwWsd/idJzSbIiAxScerME6bUQbRvPZDy2faQLJ+09MeV2136Siqj1TRAHv3BbZh6vrxklRy1eHLu4MxfiBj5nQz50kz4dPUBKn1We1qfJ8UZr3n3AIDM5bDDuIufFy3y7ao9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872914; c=relaxed/simple; bh=/kD8Dn+Vjj/4MegsD4HTU4Nit4nbFX6TZSxPnGiAjgc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=opEONTPdSm2c0lnl2kqoTLfsTHEb/+6rJHlsLvQ3AbdfD2HnXN2gri47645OSU++7T3w/SakO9tkmdK45LLScQn/J6E01gNE1j1qZ3HCRBmnbsn7S0TLaNexcsZIeVc1UcQIgULetxdQd7sHlp5ihJcKU+rL/l8pNyqFBd5vdQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=howMAKdC; arc=none smtp.client-ip=209.85.167.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="howMAKdC" Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-4ab8cb2a6e4so526721b6e.0 for ; Thu, 27 Aug 2026 16:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787872911; x=1788477711; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=opegbFI85ijkW61XNldND7ey1Wsmf3PxBxL8sOVvLZc=; b=howMAKdC7LAwFWHdAPF5hRUagsznDnow/xQMMBBQ3h96qs62FUaNSVs5BqQwaNwyKY dAEQ8lnYI2CpBpBQ/WvFb4V0D1n3Ae3jOsiEBSwZa7Yq0uldLZNLB9dv4q5KFGQz96km JgGyO/yvwZBOsjC1C0H80LwCK58/0KZ5IIPoK7u1ugw0lVs6gD637la8spnQbWnzTpoK 54uqwQYsO7bUq0UrJKp5RUwi+2yL71u18Qp5HPGJQ33dHhz8sDJPtNpQIs4lWz9qeGuw wp1KNjtFb3a6VcESWgt8/qlOul9heOlMRmr2FuezA9Ov/zhUUMG15k4AXU3hNXcGzuiX Gtqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787872911; x=1788477711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=opegbFI85ijkW61XNldND7ey1Wsmf3PxBxL8sOVvLZc=; b=r8Hpde4w0TlhFwTjVvTNmrgVNkFy4i1R7tggMX543pw7Srg+RShQNj4914c8qvKcrn SZKLiQ51HVGcJjhPrPlhTpaGInnxvHD25xcgDUFB3x00UUQSQImloNKwPNeujhMBg0jd QU4hdDOCtx7/D+xhaMG2VNfAVVlAHRPTnqJoJmSPyJnKLGO7s77ZQDmDZm3t6TJICkzk YX8kLNwivgpMN88qr1kt8hY7gBdWWLT322Gu1zc0FIg2+5LBh0KqAYMIf1WRa7IQ2VRp bVLLgLgHypet8cKe8PkKTdyxavjvhSAmNvNafYPHVZB5R/BZM5GkKm4cR6X5kEAsTbrq jBOw== X-Forwarded-Encrypted: i=1; AHgh+RoJKppOcOu/JekWtIJxWHf4iUqmg058/Zi0EHnsFKfgCHKkQTOusITCaLn7rcuA9wa68DGGuHGcW7h3lNY=@vger.kernel.org X-Gm-Message-State: AFuF++mpOaqJaIczt5RJU7HM4/MmsOjsDS3oupPSHvpyypxQLHwJGwn4 GNr++SdzF/R4gaBHwiWxnGYmJGGawpDuSmgvDV73ZK2Yc/Q28+9Gyujz X-Gm-Gg: AR+sD10snksboq1qPUZG8NKRqVU5SABlOv17xd+m5jdNei0BdjXKvjJjkM5Pcw23q3A hrbbqp3iKMcti0gD4q3MfK8np+qxGPL6WOSy/pyJCatxw1XLr/18XLgWFRnjdMnM9HHEOkJIkVH Asgv7/K1d+Lt2hj3VAry1sOotRsG6HaLivxdJigDuLsnPiB8/o9cbHiOXd+MepDc8PTEV0I2+tu ya7c04G06zRVLnj3/K5HjF5x/H4Fn9WJYM/m3gJcH5C4WxiWl1lx2mFFAqZKrb3eKlsquD6o9JU Wn769i+UFiFyQdA8h7xaSfW0Mw6ufOhTbbCy9ruiI7Rr7QulGxOHTPDhwNUyqmM2LGjaCc/uWNU j9WC9CFGwHF8jOiZNJBx/fDNGGWSLvxZICLaiCYao1dmAU3zLCPNY18tWCfgLDhiJtoW8VAN9R9 tKhE4nbRWfGzTyKpbr+KbzDWnN/FBWDV1VbilNXBcWzG5lAaYF3wJO2ndIAfabQ8+87U6yyFBi8 xkPTw== X-Received: by 2002:a05:6808:c3ee:b0:4a3:3108:866a with SMTP id 5614622812f47-4b3982eaaefmr3092039b6e.17.1787872911304; Thu, 27 Aug 2026 16:21:51 -0700 (PDT) Received: from localhost.localdomain ([2600:1702:4ff0:baa0:5054:ff:fe3d:4ddb]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b38fbfe089sm1589553b6e.14.2026.08.27.16.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 16:21:49 -0700 (PDT) From: Will Porter To: Takashi Iwai Cc: Jaroslav Kysela , "Geoffrey D. Bennett" , Asahi Lina , Chris J Arges , Nick Kossifidis , Detlef Urban , Roy Vegard Ovesen , fenugrec , Frederic Popp , =?UTF-8?q?C=C3=A1ssio=20Gabriel?= , Shipei Qu , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Will Porter Subject: [PATCH 1/6] ALSA: usb-audio: Add PM guard to Studio 1810c controls Date: Thu, 27 Aug 2026 18:21:38 -0500 Message-ID: <20260827232143.149197-2-mrwillporter@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260827232143.149197-1-mrwillporter@gmail.com> References: <20260824230302.27965-1-mrwillporter@gmail.com> <20260827232143.149197-1-mrwillporter@gmail.com> 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" The Studio 1810c control callbacks issue vendor transfers without preventing runtime suspend or disconnect. A transfer attempted after runtime suspend can fail because the USB device cannot accept submissions. Take snd_usb_lock before the driver data and USB mutexes in both callbacks. This resumes the device before either the state read or control write. It also prevents disconnect cleanup from racing the complete operation. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Will Porter --- sound/usb/mixer_s1810c.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/usb/mixer_s1810c.c b/sound/usb/mixer_s1810c.c index 2e5a8d37ec57..bdb5e3aaff3b 100644 --- a/sound/usb/mixer_s1810c.c +++ b/sound/usb/mixer_s1810c.c @@ -474,6 +474,10 @@ snd_s1810c_switch_get(struct snd_kcontrol *kctl, u32 state =3D 0; int ret; =20 + CLASS(snd_usb_lock, pm)(mixer->chip); + if (pm.err < 0) + return -EIO; + guard(mutex)(&private->data_mutex); ret =3D snd_s1810c_get_switch_state(mixer, kctl, &state); if (ret < 0) @@ -504,6 +508,10 @@ snd_s1810c_switch_set(struct snd_kcontrol *kctl, u32 newval =3D 0; int ret =3D 0; =20 + CLASS(snd_usb_lock, pm)(mixer->chip); + if (pm.err < 0) + return -EIO; + guard(mutex)(&private->data_mutex); ret =3D snd_s1810c_get_switch_state(mixer, kctl, &curval); if (ret < 0) --=20 2.47.3 From nobody Mon Sep 28 02:57:19 2026 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 009543D75C2 for ; Thu, 27 Aug 2026 23:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872915; cv=none; b=VWjqGufwpvdy7omQ8M6+2RBTinN8Z/YzpaZXZwKjxGjgZNUbHkA50mYVYyMafqfwb4h2h84et8IQ+PDb04mRmlJBStt0DzmFKEO+MbrLPvbNMSxf5YRWAzK3rszjNcdFZMo3/FkSXmrtgkiG3bj3TClY684ymh6Bq1vGFtl56Bw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872915; c=relaxed/simple; bh=OLkbXGYyZcNfD8UAT3yY0FeWpmQA9tPNWZT8QqXTR5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n90BQBVRxC1kFff50E3XryuTwGJvSGZhC8+arLEffoepUmGXLlul0zYvYtdO90sSjCCQOCj0V4KL7ULwSuJTEX0Vkk/gA5Ir5WeI7wFl2uMRPd96S5p37JH/x0JN6JPIzL8KEF0E0xcIbW+S0Qn/7U2Nadfgduq3FDvilZEKfEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qsxmOnSU; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qsxmOnSU" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-4b1ba286f6bso1453259b6e.1 for ; Thu, 27 Aug 2026 16:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787872913; x=1788477713; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OJk/diW7vSdlaTCy9g9nUpmvVfpgQ3VliAsH0dOI4Qc=; b=qsxmOnSUKgj3p72MdbZKM3WmK2fGmksvR6rrlVv+ZqGNQzxBsKrkFsyrSDFmuaDbGs 8qLIMLNuwWWwzFT6kRLMMY818j5rrvX+PJsYctEHcG0MDCDA7jdHRHyr0luD42qQRLz8 C4CZffChCTb5zW+2yDu7i9i/PaTVgRJHKdU/3kVa+OPHicxDFsuMZ/5oF/f04LsDmh64 Bgc7npDvO+8ZF/V8vPMw4DLkbnSV3sOTdly0LufwQyJvzqCAkNLJymPuKvMbTAAWRl5y 5EdfYhcknwDTqSph8ZkU2vWuHyAasQ70ChWws5nHFlzWFDa6cc6wzoQqy9R0yJILPOFK 3nXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787872913; x=1788477713; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=OJk/diW7vSdlaTCy9g9nUpmvVfpgQ3VliAsH0dOI4Qc=; b=qIYWxCSNlLM/bEi4lKO/z4CbMzx3a/5Xf2CTkYYXHHlj0Gw/2c4A3zVHraIqaMzAbX +SLJs2mupqS6P7Ux97jTk7jYXDNHeN4fIaKfQ8no9QtLH7vhsh89SK8Aj6p+Drp//opF ZbVtHySaUzkOhOm5cWsw5hPk680Kkqzp8Fjd9X3ke0/RDhSbCqec2Gwaw48QvIrzrfy/ ADitsgFX2szalZCcbDYx5k+O99FXQKGOM1rEV0+rEd555V8JwYa9uzS7m+uH8q1rTmfu xapX6Aow9sm6wCXPHgxL8E1+6YW1udCxbkLsZgkbXkuoVMW1pXEdTpjzLSH308pOmM7R GBrQ== X-Forwarded-Encrypted: i=1; AHgh+RqJlO+4yeAeYbAq4/1YQPJhid9qodWdT89RBnKT392lD0LXehdtjzG+yIBEBFjVcDTsC0ARUCCGxpgyub4=@vger.kernel.org X-Gm-Message-State: AFuF++lzHM5rDpPe7d8RS7zzh687MxveX2F92nxNlP+GzSxQRhlsFJ2N 5qA3IKukjtvvsWCFSnliqhhako+2AU6CBGBhz1nH/c2je5Qcpz17isTm X-Gm-Gg: AR+sD10Y0FpYt28MoiemXUAhuPdNrvbk0SM/54zDmXV+plRnR0+snbJsPKrr/+hXMnV ZtUVbBTsIVDlm/9yQv9s1tza/qT8AG01YA1JSOImQIr4bM9UQN/Vdpo9Rg46VAI9RxADTSu8u9/ k3wogOa6lx81h/N/1po8f1bKFXcLAefSQQkgL8KdsTux7BEMLYbt1jgF2tW295x6/HbqDO9tPNx NVJRgdtvMn0kVVQeCESEKqC55kNVZCXWRJDwQFV4iVm/5KJsyqqBVE9yIP7Q4nKJRqgnz4MGXiq ALHeoxi6pWcjIhPFpyECLohcxHznNHI7HJfpXwroxxgqpHvxwh9igKOlVWOtLnszXRIE5t+yxjy GWmrsdzr3xwvbyupJFvCnBKFmHzjmZ1u03EsBdwo6Bnu3VzXdz3DchTz0GQ9CBvdoWhi1jJyCGK 4gxEUuDgZgQxQ2dGW1dJVWZgTAZgHCnQ5xx+uQGKoLkFCCAK+bMGkqTap31KbH+m7cU9Wa2tv9V Ek9t2Kh0va+BNcl X-Received: by 2002:a05:6808:10d2:b0:495:f697:92d9 with SMTP id 5614622812f47-4b37c88e895mr9695964b6e.7.1787872912836; Thu, 27 Aug 2026 16:21:52 -0700 (PDT) Received: from localhost.localdomain ([2600:1702:4ff0:baa0:5054:ff:fe3d:4ddb]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b38fbfe089sm1589553b6e.14.2026.08.27.16.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 16:21:52 -0700 (PDT) From: Will Porter To: Takashi Iwai Cc: Jaroslav Kysela , "Geoffrey D. Bennett" , Asahi Lina , Chris J Arges , Nick Kossifidis , Detlef Urban , Roy Vegard Ovesen , fenugrec , Frederic Popp , =?UTF-8?q?C=C3=A1ssio=20Gabriel?= , Shipei Qu , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Will Porter Subject: [PATCH 2/6] ALSA: usb-audio: Add PM guards to US-16x08 transfers Date: Thu, 27 Aug 2026 18:21:39 -0500 Message-ID: <20260827232143.149197-3-mrwillporter@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260827232143.149197-1-mrwillporter@gmail.com> References: <20260824230302.27965-1-mrwillporter@gmail.com> <20260827232143.149197-1-mrwillporter@gmail.com> 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" The TASCAM control helpers submit vendor requests without preventing runtime suspend or disconnect. This affects mixer writes and the volatile meter path. Protect both send and receive helpers with snd_usb_lock. Acquire the PM guard before chip->mutex in the receive path so autoresume cannot invert the mutex order. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Will Porter --- sound/usb/mixer_us16x08.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/usb/mixer_us16x08.c b/sound/usb/mixer_us16x08.c index ebff185cbd2c..14fb1ad764a7 100644 --- a/sound/usb/mixer_us16x08.c +++ b/sound/usb/mixer_us16x08.c @@ -151,6 +151,9 @@ static const char *const route_names[] =3D { static int snd_us16x08_recv_urb(struct snd_usb_audio *chip, unsigned char *buf, int size) { + CLASS(snd_usb_lock, pm)(chip); + if (pm.err < 0) + return -EIO; =20 guard(mutex)(&chip->mutex); snd_usb_ctl_msg(chip->dev, @@ -165,6 +168,10 @@ static int snd_us16x08_recv_urb(struct snd_usb_audio *= chip, */ static int snd_us16x08_send_urb(struct snd_usb_audio *chip, char *buf, int= size) { + CLASS(snd_usb_lock, pm)(chip); + if (pm.err < 0) + return -EIO; + return snd_usb_ctl_msg(chip->dev, usb_sndctrlpipe(chip->dev, 0), SND_US16X08_URB_REQUEST, SND_US16X08_URB_REQUESTTYPE, 0, 0, buf, size); --=20 2.47.3 From nobody Mon Sep 28 02:57:19 2026 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 BE7AD3DC4DD for ; Thu, 27 Aug 2026 23:21:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872918; cv=none; b=slSPXw7xpXHn79jJmYqhii/nqHzegtxk1MreCJ0ZS7QWNa7+3p2aWLFL8uoSjOxkQ2LcTgWBmpBy/F/SonUd1ChzF6G4ii5VXS7MwmhJ/e+WwCI9uDdaQv3AU0BxS+wZQWN7IEjfP4Lmydyw2ZMLmgXLRLh7d7wiB9YgwDlq1YI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872918; c=relaxed/simple; bh=ePzkJoNpPalxhOCXt5PVJAtsXVveyLh3mOZy7XB8YIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hr9soC8+8s+5YGQ3JPYCavrNuaKl4N5o1dofBpICQ/ybtDDuLePtnf57uF3tUp+kQTwC9iNDexHYY7q9+3Yx5By5Oa+v6XjxZ7kdoUziB/wsQFeOVVoVrh5ibHm2Q6TYzfkAi/ujv33SFhwb34AiMj0MPSbthLJH6D2+ZUmar+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=npcxS452; arc=none smtp.client-ip=209.85.167.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="npcxS452" Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-4b21f09ec76so522155b6e.0 for ; Thu, 27 Aug 2026 16:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787872916; x=1788477716; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=q6j+81W5sTdSzj/6qIi3uJWGbH2J1mlEvsG2WkACG8I=; b=npcxS452B5JRjqgAxq6RBdGnfPKIrfGVkgMZgrz2zOj8YsyLjT88zY1pb74w2NXVDH Unw9wLCX+w+k2SNCVJj84AtADols0TirCROJUNNK/fRgFBysbEoqaZ/doMYubsAEWfSh pZVLeK3lCYr2vAeYxCATWdYyV2kFECO5uDZ2ciX8iyWxaYHnh+i+VRU0aZPP3MwGrQOJ 6XiKvou4iFa/WRlhrtqIQpJKt9WEIjdBtNfqG1kdlmAOeqzGRJchHurPFFq5USoYUiM/ 17VG/jHX/YyhA+rcSflb6sg2Zm5RQhk44F3xm9gG+e1pKq17bY1w29fPN0qCkYA8x1Mp C0tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787872916; x=1788477716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=q6j+81W5sTdSzj/6qIi3uJWGbH2J1mlEvsG2WkACG8I=; b=msvtEycvqkmhDh6DKM60Qpfarl7ep2BXM94h8TsVJFTp+D+UiykgV0z4pnMhl0Y94D i6Ih/ymvv5UIEds93tyxa3kYGo1kb4Gp8sGQ4MGaMsmXH85t4YBvwS/RZBkHAISxzVV2 DVvgGlzoOUMrChpNg6CuhuFyLtfkMTFimQCinFZXjTDZF22HOQEQV6DJ4ixpi2grhZdK FTyRqFNuQliede9i4GlsxQ2YkqEku8I/L71UYiCWozHXR58lLpnILTgwz95kzI1kxa27 aXcB58mmTXkpzkWnIxUZFE4gXK3gaEPfyzX+TIijZWtgGpGhnVi5z/EqgDSOp+ErdqKc 8Y3g== X-Forwarded-Encrypted: i=1; AHgh+RqoocAZPP6XiOskNs43eZV2CSqmJ8O7TKd+Y8UDGu0MXuX0GZVOWzjkGH+S66lsUfgibuoAx1gxL9F0HwU=@vger.kernel.org X-Gm-Message-State: AFuF++l3DyvNHFJmQklj5G26zmvDrZP0Ucg5r/L58wPoNXSpEk8gwKcH oLwY1OYgGwDXVBJE81M3Z3huAdHTWlKlNkpzUv1ZZggVnk02ngYOX9JP X-Gm-Gg: AR+sD11RlRC+feDG0APBa9rZmcXFliQgr6LfGeYZhRJqEckLD+VegwMZb4BqXYY3qcf ek+xhUVH75A7HCZGxzxQekVkClvnxW+oj0Yym4606FyhLM7ltlMV2rq3AD8mIQHPSWWdmDQoBkM 8uHPj8y/0YxvM90X1LajWBo+c6R4vlpd1kXB8FpcAfcbo2nmgey54islCzew++HhVSqKLODKyeB TA+ZAWDuBDoFLNO4Qlu+AJDoU4jDrmTjzjDUmAUAezTIfHVHJ1HKk6Z6DaCnws++CQflVPa5BTA gaxNsP4Ylf4C1r6eC1qH+bRcLI9LVXMWQRjUMwGUxlckO7BJ3B9G5hnkJD7ocebEBa+J63Cukxj WI3AjWkTwyiya2bPTkAqlRaexQknOniVadnO34iu85KeZu2W1TH5Jpd2VtnxaaW7kX5OEkGpUZO yw0PMoupdgkhnorvaNO22yu+yRclBul0nbObXe6aShOBBG79TYd7Xqz3RRxNXwal0B/LbHcvj+W Nj9IA== X-Received: by 2002:a05:6808:190f:b0:4b3:7efc:e970 with SMTP id 5614622812f47-4b3980115e8mr2982157b6e.5.1787872915662; Thu, 27 Aug 2026 16:21:55 -0700 (PDT) Received: from localhost.localdomain ([2600:1702:4ff0:baa0:5054:ff:fe3d:4ddb]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b38fbfe089sm1589553b6e.14.2026.08.27.16.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 16:21:55 -0700 (PDT) From: Will Porter To: Takashi Iwai Cc: Jaroslav Kysela , "Geoffrey D. Bennett" , Asahi Lina , Chris J Arges , Nick Kossifidis , Detlef Urban , Roy Vegard Ovesen , fenugrec , Frederic Popp , =?UTF-8?q?C=C3=A1ssio=20Gabriel?= , Shipei Qu , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Will Porter Subject: [PATCH 3/6] ALSA: usb-audio: Add PM guard to Scarlett meter reads Date: Thu, 27 Aug 2026 18:21:40 -0500 Message-ID: <20260827232143.149197-4-mrwillporter@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260827232143.149197-1-mrwillporter@gmail.com> References: <20260824230302.27965-1-mrwillporter@gmail.com> <20260827232143.149197-1-mrwillporter@gmail.com> 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" The Scarlett Gen 1 meter callback reads the device without preventing runtime suspend or disconnect. The transfer can fail when userspace polls the volatile control after the device suspends. Hold snd_usb_lock across the meter request. This matches the guarded Forte and common mixer control paths in this file. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Will Porter --- sound/usb/mixer_scarlett.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c index 673eb8d8724d..369968565c19 100644 --- a/sound/usb/mixer_scarlett.c +++ b/sound/usb/mixer_scarlett.c @@ -707,6 +707,10 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol = *kctl, int idx =3D snd_usb_ctrl_intf(elem->head.mixer->hostif) | (elem->head.id = << 8); int err; =20 + CLASS(snd_usb_lock, pm)(chip); + if (pm.err < 0) + return -EIO; + err =3D snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), UAC2_CS_MEM, --=20 2.47.3 From nobody Mon Sep 28 02:57:19 2026 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 3383E3DC878 for ; Thu, 27 Aug 2026 23:22:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872921; cv=none; b=uyvtc5Uj0y+c8zS0ge80xZF07ZXmirw0ORGpNgevutrQE5qDcbKzbaVdCdc1tmkbOenbMK22UHRAEy0/Hkq8oaFlCwpPW57pieVGPvSVAbw0u7bc/LRWZd/REWXn5HezblGUzIKyjR512N2gTyYPBc9p8GlRUm5TehUsKfWi6fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872921; c=relaxed/simple; bh=e/Bu9tGinqn0oPwIBbllDvzdk9Z/chxdVrt6JyTUUiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d3gmkCpQD6tnkGeBF0Dg91HtTLKL5ijzRwVojvDvx+uGgfnZA9C6CdKTokWiDQNzh6dEP2FMpr1pgbbjCJli7LBbRXieRXUwElsgy7sZsQPwmsAyUVGO6eEuTdi1lhpvMOxyLtE9ykQMSJ2rCQ3VUZzSIw/WfINW4ePGD7ubW7w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H1zMICxa; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H1zMICxa" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-4b383347fa6so1112283b6e.0 for ; Thu, 27 Aug 2026 16:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787872919; x=1788477719; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Ial078NkMLwCx72YKPqRkqjVXPsF6XZg2wkYCbXAeYw=; b=H1zMICxaBzDZzrz7Mj0KUbN/lJBQ+iM4OPy5yhT1x6Fp0kuXJEqgjJ2xjIiYKc0UiL osHpH6KVUab/jfE3ehnUvCkl6jzI2TOVvVOqfmuNUFFpFEQPuMzvFbCGPPsBa0VExmDg OXqBk5HuRzPk1c2T8uz93JevBuzLOWwc3JjcFUEWw+OzYRn5pmxfk3CbWS4A89EOYRNo x8dL1wU9uLjrAIBlnu47XEQwvSyEYYuiPrWRIoKTDIHNx8RFgBlPShhvCaG7G5jRkTDb ZeinUiD83jzImXpX3W8Wqg2rIvx20phlxU0BP45+rTrRQswY6QuEgvXNdMaCx5jEsWdY C0rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787872919; x=1788477719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Ial078NkMLwCx72YKPqRkqjVXPsF6XZg2wkYCbXAeYw=; b=ULCwLvH9ztlhktMxQlSsq2clwgV+zWK49q3JUnwQ+x2vEs5bOHA5J9KRt7fpMF/ONu KYjM33kA/h9ydBFHrt1ZHgzd0y61Pcx16vAvmIQYa7wSDX02VayF/zae9VCYL6JOxWeG gk8ICyrDLANg3bZedu2tIExsyORf+BqaYqAwfKzDKbySoYfs14i43ej3h1EHx6aSaBW2 aC2lTKNFZrkA1ogjMzZRMc+m8iU51O2CAePXueTsfeJlS7LJ/1TgNkqbQRO4TjfrF2T6 OpFaBE+K7169WhbySvzZGwLbxeaVniGeyNYnVgTItNJX1fvv15vB4U3ZomFd2UEmsGmK CyrQ== X-Forwarded-Encrypted: i=1; AHgh+RogNqsxWodR+uwJCfrwGTrYv7qFYfE749gVwi6UgS/Vftgz3ycWuZfZoZ5nB86+B55Ttoyc+jMYeZYs5EI=@vger.kernel.org X-Gm-Message-State: AFuF++lIDlo37TQ3uHvWgTbzcW9yELa8zV3Nq3nBz+ZZB4x3k7rMnyhw hCdLc/84E/Slw5wwYpMozOxDuwAzJsCwLIGgTxWnLBOfU3F9Zxzrt5Mq X-Gm-Gg: AR+sD1200pTSgdFT268bwK18LTTxqwZeXBl2kFxyewen35Blcz3Wvo/e3aaK3Vk0qa8 XepwZq5InekyiV0A9ivxyVXBSq1WtGxnqBB5+vZT/IqUPAtG+SDFuI9uzUUnDDKgzU30M1ktkOG 3w6EweESrD/VBg/KIfvyXzt609tVWJMfMSiNy8ccbQCNGhSRWeZwO2rI0/RPRY0ZasTqjeLxFMu Z7XFvabeG0Qq/YHXRSnVrKaYccnv/Ph0xBF0Pa/sAEh+ZalnkI05H05Xa77YYfGNUWPqPZ+rTy3 D5lFSmNgW4TflA7bUpMjssQ6gufSs7Q+HBovaLLOdM0NVvmDhEA65XTJBHThp70PzZhq6y5WN5A zApudnA9pQVKeCDUluNNQgngpWfUCUb/S7cCPnToSI8MOQXgtwJNt7/BlQZ5YQ3RbPx/c1rW6DY GXKF4qobM95bjEBinhrvnwpwNY5Hj5s/l20nNJOyNIJRjsR7I7oljeY8ejjZbdneVDXAZCo4D0N REJkw== X-Received: by 2002:a05:6808:198a:b0:4af:aaca:7be3 with SMTP id 5614622812f47-4b37ca62369mr8499737b6e.12.1787872919055; Thu, 27 Aug 2026 16:21:59 -0700 (PDT) Received: from localhost.localdomain ([2600:1702:4ff0:baa0:5054:ff:fe3d:4ddb]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b38fbfe089sm1589553b6e.14.2026.08.27.16.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 16:21:57 -0700 (PDT) From: Will Porter To: Takashi Iwai Cc: Jaroslav Kysela , "Geoffrey D. Bennett" , Asahi Lina , Chris J Arges , Nick Kossifidis , Detlef Urban , Roy Vegard Ovesen , fenugrec , Frederic Popp , =?UTF-8?q?C=C3=A1ssio=20Gabriel?= , Shipei Qu , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Will Porter Subject: [PATCH 4/6] ALSA: usb-audio: Guard Scarlett2 protocol transfers Date: Thu, 27 Aug 2026 18:21:41 -0500 Message-ID: <20260827232143.149197-5-mrwillporter@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260827232143.149197-1-mrwillporter@gmail.com> References: <20260824230302.27965-1-mrwillporter@gmail.com> <20260827232143.149197-1-mrwillporter@gmail.com> 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" Scarlett2 controls and hwdep operations reach the proprietary USB transport without preventing runtime suspend or disconnect. Protect the central request-and-response helper. One reference then covers the command, acknowledgment wait, and response. The runtime and system resume hook submits only the notification URB. It takes no protocol mutex. Thus, the transport guard does not invert the existing data_mutex or usb_mutex order. Keep the suspend-time config save on the unguarded helper because it runs inside the USB suspend callback. This change protects each USB transaction. It does not hold a runtime-PM reference across the asynchronous flash-erase interval. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Will Porter --- sound/usb/mixer_scarlett2.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c index 502854cc9f9f..ed5fe746d438 100644 --- a/sound/usb/mixer_scarlett2.c +++ b/sound/usb/mixer_scarlett2.c @@ -2603,9 +2603,9 @@ static int scarlett2_usb_rx(struct usb_device *dev, i= nt interface, } =20 /* Send a proprietary format request to the Scarlett interface */ -static int scarlett2_usb( - struct usb_mixer_interface *mixer, u32 cmd, - void *req_data, u16 req_size, void *resp_data, u16 resp_size) +static int scarlett2_usb_nopm(struct usb_mixer_interface *mixer, u32 cmd, + void *req_data, u16 req_size, + void *resp_data, u16 resp_size) { struct scarlett2_data *private =3D mixer->private_data; struct usb_device *dev =3D mixer->chip->dev; @@ -2713,6 +2713,18 @@ static int scarlett2_usb( return err; } =20 +static int scarlett2_usb(struct usb_mixer_interface *mixer, u32 cmd, + void *req_data, u16 req_size, + void *resp_data, u16 resp_size) +{ + CLASS(snd_usb_lock, pm)(mixer->chip); + if (pm.err < 0) + return -EIO; + + return scarlett2_usb_nopm(mixer, cmd, req_data, req_size, + resp_data, resp_size); +} + /* Send a USB message to get data; result placed in *buf */ static int scarlett2_usb_get( struct usb_mixer_interface *mixer, @@ -3020,9 +3032,21 @@ static int scarlett2_usb_set_config_buf( /* Send SCARLETT2_USB_DATA_CMD SCARLETT2_USB_CONFIG_SAVE */ static void scarlett2_config_save(struct usb_mixer_interface *mixer) { - int err; + __le32 req =3D cpu_to_le32(SCARLETT2_USB_CONFIG_SAVE); + int err =3D scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, + &req, sizeof(req), NULL, 0); + + if (err < 0) + usb_audio_err(mixer->chip, "config save failed: %d\n", err); +} + +/* The USB suspend callback must not acquire another PM reference. */ +static void scarlett2_config_save_nopm(struct usb_mixer_interface *mixer) +{ + __le32 req =3D cpu_to_le32(SCARLETT2_USB_CONFIG_SAVE); + int err =3D scarlett2_usb_nopm(mixer, SCARLETT2_USB_DATA_CMD, + &req, sizeof(req), NULL, 0); =20 - err =3D scarlett2_usb_activate_config(mixer, SCARLETT2_USB_CONFIG_SAVE); if (err < 0) usb_audio_err(mixer->chip, "config save failed: %d\n", err); } @@ -8639,7 +8663,7 @@ static void scarlett2_private_suspend(struct usb_mixe= r_interface *mixer) struct scarlett2_data *private =3D mixer->private_data; =20 if (cancel_delayed_work_sync(&private->work)) - scarlett2_config_save(private->mixer); + scarlett2_config_save_nopm(private->mixer); =20 scarlett2_cleanup_urb(mixer); } --=20 2.47.3 From nobody Mon Sep 28 02:57:19 2026 Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (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 AC9523DB320 for ; Thu, 27 Aug 2026 23:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872925; cv=none; b=IyUG+vlf1ZxVH88u6TmFrutXizdY+bdC0XWspdLtXReF0U2C8N6Io0siZMevjKTtw7yTdP1QkC/AzQlC3+Cb/Ly4P77Qd9la52uvX3rbGnwYldpJCpOAX9qn2WPYK35SYVd1sAgUQLVxGX/S/N+Wfai7z7RQwtz73xKabhCTaAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872925; c=relaxed/simple; bh=PURQP6ZO5l8U5LecyA8nFec2CWoAEjm0KPyDK/TL9pM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C+LnqloI8ZL6gRdvqxwBzOVP8wSVtDzAuBkR3u/mlYu1XG2m7ozTv+LFgeMOBES0x8ZWyAg69KKKYXXKR2YrlyDOlPUEyYijrTUMysvoby77nRY3YWd6mZKZiSdcYXHciuBFawfWYpjFnw8q95MDEh3qUR+NzDqHXdwY0qMPS50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZWZ9D1BW; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZWZ9D1BW" Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-448b0ff4a57so842294fac.2 for ; Thu, 27 Aug 2026 16:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787872922; x=1788477722; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=17uEs7Ned+dWqz4ZIVhnARGDREWSqKdWLg/j4K6DqdM=; b=ZWZ9D1BWZxBYe1ODuWt0Mtpqaz1V2Uvwn7F03fLy0019uebUeYmUkBHho0FS9SiP3D 6XPZdUeJOG3qzk575m+gDnqIcW3V+w+B4HEUgyy1aGPFbE2pt/P2jB/7n8XQ3b8fcdxJ W3XXaapg92W258yWzKP07lMJ5D8g6TYAL4T5iZcf4jV2FO1pt7769A3S35v00xrmaUsr jC+kZhw+fzrWXDGA78IDlskuaqC67/tSBMQrcj/ApzmUK09mtMBdXs5Ztmb28VmLdn15 8wS10InS/Ojx9tv+El7dtGyaVSgeO0FZWgK5fKuvz6JsOQe8Uo01gi9T1ckBnjxaDv88 2Urg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787872922; x=1788477722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=17uEs7Ned+dWqz4ZIVhnARGDREWSqKdWLg/j4K6DqdM=; b=o50TPDzi+Y1H0pYBGTOinS9sUaxy4TYt+aYrrofh6ZlvfOAh7rwDCHhSVnyJsL3dTQ eSsuOR8QUwvSQiSoWHkWtl7e+pNYMLqflarc/YSE/LcNP5x+D5brMNorCWqXkS/erX/H 8RjsS7C/Ye0la/fe7Qz+gyUBkZ0/Z7WwXYg36gjxdwRECD2GOyd916n1rLSk03nDIlF4 vV+kdzsRMs6LwE1jYoYjxsSvbvfMr9b0kCRlhNXOuZqgtlPHF8Av0jVRU24N1ixV6BXv sBEP3Ct+2eMFNjiPhtDNX362Styl+8pU2udfDtCqSg9bw+RVk0KFVjY9jVnRNoP8NLTq imAw== X-Forwarded-Encrypted: i=1; AHgh+RoGpBtNuR+XWtLT7ixz6st+LK6oeEDYfsIq1+QJf/UOAQ46f7uLTbOgGnrtdyBkf7BFgOehRyY4EPUnmL8=@vger.kernel.org X-Gm-Message-State: AFuF++lFcg32qMah5j2KwDQDsJSz0yCjSzQmwCY9X2zTBNlqMiicBInv BULyLRQigpG3OJ9SJ6CilHGXqKI+Ze0H1eJnEdEA97Ym7gDaR8IToUhd X-Gm-Gg: AR+sD1060/UlNUw6onfkD9OZH3FuMu1/xQJdsyrd4hV32ynfkhM6eCZdxg3ihRlgexp k+MUWnebBxflSmaqlkdRsGJMOBPwyT6HrqZ1yaGNOGfrzYvhOn8noXt8Re8ZqtQoyvIu8Jb+Gec 13H13TLX1txJYI8udcRQ/crQ6f9ZyrgRUdjsF3bHXTH8HZqC0D06zagTmFAn9JItfXaJkvo6zjZ A4eQXIMPu2XmjxNN5iK70IW0EtedSsaaOMDMpnS4LivxfOYSA/RZOJxK3kB0S3nPNbmiYsiBUaD ZpAsYLXyPAxeAAgx5LSsDEpwG8uqkgMufdb6MiPFbS0okugO1cZdqc6+0Zbe7/nBJak+25jPl1v TZJwOqvk8ifcCZSZrv2DlLT1bXpdlYHwnw98Dkg14YJYeh4F0hON191ny5HGHm4kDz0IbYAbLVK JhaNPlGM2YWFaEBM6hJZrxBXE/XimPTyoIor0+4VG2ivFYqD6NwM73W0Ol3oJcn3geldlkletke HgIi0cCoh54JcbE X-Received: by 2002:a05:6808:c3ee:b0:4b3:1e40:6451 with SMTP id 5614622812f47-4b397f09e25mr3397971b6e.1.1787872922428; Thu, 27 Aug 2026 16:22:02 -0700 (PDT) Received: from localhost.localdomain ([2600:1702:4ff0:baa0:5054:ff:fe3d:4ddb]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b38fbfe089sm1589553b6e.14.2026.08.27.16.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 16:22:00 -0700 (PDT) From: Will Porter To: Takashi Iwai Cc: Jaroslav Kysela , "Geoffrey D. Bennett" , Asahi Lina , Chris J Arges , Nick Kossifidis , Detlef Urban , Roy Vegard Ovesen , fenugrec , Frederic Popp , =?UTF-8?q?C=C3=A1ssio=20Gabriel?= , Shipei Qu , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Will Porter Subject: [PATCH 5/6] ALSA: usb-audio: Add PM guards to RME Digiface controls Date: Thu, 27 Aug 2026 18:21:42 -0500 Message-ID: <20260827232143.149197-6-mrwillporter@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260827232143.149197-1-mrwillporter@gmail.com> References: <20260824230302.27965-1-mrwillporter@gmail.com> <20260827232143.149197-1-mrwillporter@gmail.com> 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" The RME Digiface status and register helpers issue vendor requests without preventing runtime suspend or disconnect. The volatile status controls can repeatedly reach these unguarded paths while userspace polls them. Protect both helpers with snd_usb_lock. All Digiface get and put callbacks then resume the device and hold the disconnect reference across their transfer. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Will Porter --- sound/usb/mixer_quirks.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index a1f5592cc5d5..fc622eb95dc5 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -3480,6 +3480,10 @@ static int snd_rme_digiface_write_reg(struct snd_kco= ntrol *kcontrol, int item, u struct usb_device *dev =3D chip->dev; int err; =20 + CLASS(snd_usb_lock, pm)(chip); + if (pm.err < 0) + return -EIO; + err =3D snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), item, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, @@ -3499,6 +3503,10 @@ static int snd_rme_digiface_read_status(struct snd_k= control *kcontrol, u32 statu __le32 buf[4] =3D {}; int err; =20 + CLASS(snd_usb_lock, pm)(chip); + if (pm.err < 0) + return -EIO; + err =3D snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), RME_DIGIFACE_READ_STATUS, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, --=20 2.47.3 From nobody Mon Sep 28 02:57:19 2026 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 424C23D9DB4 for ; Thu, 27 Aug 2026 23:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872927; cv=none; b=ZZT+Irwkd36XzymUjvhmerA0LD3iSJnp2aFMBIpIrGEhqjvwlcFDVmW3XMbYNlZERLZ6pUtZlnEwgRWrDGhNlVRJ/mL+R8LqLg39e9vQGR6jF9YDcVjZt10jpE0O50RIZTQG4/HafbzboYPLMSCn2IvmMMseQsNustzPFLv+E4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787872927; c=relaxed/simple; bh=pZwz+f8Jrl4t8j4pbfuvXzvgW56/tDJ2sxBemNi0t/g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Msh7BEC+nfaM157Mt7z848yQbp2yMJOmaRzTWrr/mzSKo6Nt23eREwBsYTQqL3U/oZbFwEhCgJqx3bQDGR14Zgt6RwxGAsayDy3vCGP3dWtsAckAg3+0QAe8/rwV7mOotlInl222hsVkiHlvT8auGs7QU8hvOuxu6DaKpFsRqxU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=emGwcFid; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="emGwcFid" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-4a45b3f0becso491374b6e.1 for ; Thu, 27 Aug 2026 16:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787872925; x=1788477725; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=O+4qeVVVSQESc4ddkEUc5FBIdc2XaWCbbfUsn4FAT3M=; b=emGwcFidEtBEBAjw0JVY3UiNYTxO5dwXsVgh+9y0WnAb0ABV/dmsyTRgtODDwGCqMy xBqoL5KrXoUuT7aV0tQooAqfoPHDbn30dnlDcF9ngxDsOWsG4IhKrvsdjtVDygG9k3Ee 2GkbMb37+WJNGhIDbpmmuE1uTacARbVbvbBu9WVFFKzTF3PV3NT7AHxHcXxGRfe9m0nF 1wrYZhbJKWatKXaFy0It52Et82JncI/wdi7MbcweXRbZIFvsTp2/engRvDHGMfW4NQTw 2o7Fu0aVEUH6h3V3ajpdDzg3yndRCaUGzK1n2vPVHQNlWXg85Zbngr/Zz6shvHq0E9t0 8pOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787872925; x=1788477725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=O+4qeVVVSQESc4ddkEUc5FBIdc2XaWCbbfUsn4FAT3M=; b=d1+CdT+gU6KoxHoPGnbk0+HAGtCyjoLa3zDKAlJ+R6zCBAu033jlD8bZ/YmCS1wr1B OpgkQMM4vpyF8rC8UyiDcRN7XM56QsRKX6lONSWoo5q8S9wl/xaT/uWuq/ESqx0R/i16 6iZu/MjeGYY0RB0kZ5mYcq9KAv2YmIZQKZh90cbZDJwNNoGgknLrvdrYiSBcDFgPd3FN E/9wIbZPw71ZnRgHFJJAmuLxf7bEXv6aSG/OEYeq9mUrwHlkoZjZvVy5D9OILJiP3gy0 13FBNYNObj/mbLICOVU0y7GU/QyKzwTLUlwcbSEcRcE1HeDSVCAbtJ1x5sqBDPdWKvoo 4DeQ== X-Forwarded-Encrypted: i=1; AHgh+Ro0HdIySB2m/imLUg1+eDj4Km7Ssq1YLyw4TZyMgYm9tl+WC9ImKpjkQm094s1QlX5hyBbTRmO1g6+ICQg=@vger.kernel.org X-Gm-Message-State: AFuF++nNWm2gu/5wLsIsfT/l+K3Bz92YlDwGL2QIkkcmV+WASNaBV7UT 3x0vI83OHjVcJgaBqGVHhdm0+16QBXKtNY9mPQEaBFX0Ardi1CH3GdRh X-Gm-Gg: AR+sD10yXACT1uvMG147shVvwIs844r/8h7OU84Cnwb4wLo0XPcr+VziHjokA67q+FH QggIaLMRCZIcc33LknPn3ntNTcBeJcgXSDTYOohPB9JIVmbmOIzHxCsAwBaAf8CnUruT/sUt8vQ xuP2YQyiV2NA1BEk3UrqdxYjY60WC6lVZsppfpMsg4XcwIVufy7GV6XBwh7GOEGahCoz/y+D5EO 99NH/DDcRLejdcIs0XpejCd9Dm+cCV2Yl7cKVUofJbFPHH13IUH5Ojiyd8LQQ/rFPZEZAjCMca2 tQHt+szWafvnGL7Jbm3QNiYHVJGtvkE3E8s/N7V6NiEctSVoGfC+q/6RM/CHe8nleXYQBdyMFVe g++SX1BZMGVA78L2cyTpHi5m9nmUzjPaWj2hGeSO2zM4hFfgNMaBzLSr0m97IgibIWQrX2PSWpx 3Lq3sGBeMG+TVbvaGFw+Vb9zfBkx1lph4Dt3XQfnxUx1wZCVtlx52f+9VMcK7JuvRz6nSaaLAb5 E9kpw== X-Received: by 2002:a05:6808:538e:b0:497:8f1:df07 with SMTP id 5614622812f47-4b398038bdamr3195085b6e.7.1787872925030; Thu, 27 Aug 2026 16:22:05 -0700 (PDT) Received: from localhost.localdomain ([2600:1702:4ff0:baa0:5054:ff:fe3d:4ddb]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b38fbfe089sm1589553b6e.14.2026.08.27.16.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 16:22:03 -0700 (PDT) From: Will Porter To: Takashi Iwai Cc: Jaroslav Kysela , "Geoffrey D. Bennett" , Asahi Lina , Chris J Arges , Nick Kossifidis , Detlef Urban , Roy Vegard Ovesen , fenugrec , Frederic Popp , =?UTF-8?q?C=C3=A1ssio=20Gabriel?= , Shipei Qu , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Will Porter Subject: [PATCH 6/6] ALSA: usb-audio: Guard FCP protocol transfers Date: Thu, 27 Aug 2026 18:21:43 -0500 Message-ID: <20260827232143.149197-7-mrwillporter@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260827232143.149197-1-mrwillporter@gmail.com> References: <20260824230302.27965-1-mrwillporter@gmail.com> <20260827232143.149197-1-mrwillporter@gmail.com> 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" FCP meter and hwdep operations issue control transfers without preventing runtime suspend or disconnect. Protect the central request-and-response transport. One reference then covers the command, acknowledgment wait, and response. The initial step-zero request bypasses that transport. Hold an outer reference across the complete initialization sequence so the device stays active through step zero, notification-URB setup, and both initialization commands. The central transport keeps its guard for calls outside initialization; the existing active counter balances the nested calls. FCP has no private resume callback. Its suspend callback only removes the notification URB. Taking the initialization and transport guards under the existing protocol mutex causes no resume-side lock inversion. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Will Porter --- sound/usb/fcp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c index 5fc2131b4561..68bb7eabf107 100644 --- a/sound/usb/fcp.c +++ b/sound/usb/fcp.c @@ -191,6 +191,10 @@ static int fcp_usb(struct usb_mixer_interface *mixer, = u32 opcode, const int max_retries =3D 5; int err; =20 + CLASS(snd_usb_lock, pm)(mixer->chip); + if (pm.err < 0) + return -EIO; + if (!private->urb) return -ENODEV; =20 @@ -1026,6 +1030,10 @@ static int fcp_init(struct usb_mixer_interface *mixe= r, struct usb_device *dev =3D mixer->chip->dev; int err; =20 + CLASS(snd_usb_lock, pm)(mixer->chip); + if (pm.err < 0) + return -EIO; + err =3D snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), FCP_USB_REQ_STEP0, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, --=20 2.47.3