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=1794273962; b=YLvrdBlYoiB9Uvc5YyBzT2E0obyBjtw8+yo0t/0tDa5i0PS2IIjji1pqjupGnQbMjevu rl5yIorfZCnR70U3rxe4BWu/AodVBaIoaOvSgmjq0cvKrxGwlIuEsePbqLH7KEevq1NtV wbqDOvEOVCIkQlem7lT9fE2J+Vtn/t1yW9EX8a1JbbV7alKDA7608lnJEXbT+9UVLgw/Y wvvCN1yUTj3+Zu+zpcwYESi4sflqAXkeA8CHxlJIyOydHhfmiWZwbLPsyZmbzN1ZTQGH0 /mDItPHLuTIF1uUHjXx7clHN9lZoVZMzaSn4VBIKAXR4g0Z+bfMus+FRUdXJuNcW8DQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794273962; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=vxKz2w5gXsYTh4OYMhcEl26tiFjU8/+QGzpbooDwLDg=; b=LIq1SN9MDv4Eaky56ziw83q12jY4xXu+897eIyOkj3exp0UyRc2v7yuCziuPEC3FoWIX 4eEVzUP6mdJApkOQRAUXIkFa3v/XasseR+Pq2pbAB+itoJmyjjrifRUx9qpuJThdxgSra BaRa+NG/isrK6R2Fvm1/y0P1YMjfruVdTYAlUsnRalNVGdNUpBfdpbbxIrSeI0Vhb7oHN eFExIRnegPRVgSPyFQzgLo8mq7JE+3VcRcwfEuIadJT3DyFjeJJDAbnj539/f5kBqrT32 AbiNeP4jPkLnQDNjUUbEFQw8nxvUYGaAocn+54CngQtlIbtLOfRUbcRWdXz4s3n0AMw== 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=hvCE3SxQ; 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 B5AA860A2603 for ; Tue, 10 Nov 2026 01:26:01 +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=hvCE3SxQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC4A71F0089F; Tue, 10 Nov 2026 01:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794273961; bh=vxKz2w5gXsYTh4OYMhcEl26tiFjU8/+QGzpbooDwLDg=; h=From:To:Cc:Subject:Date; b=hvCE3SxQ4tJEGjjSCpdBB5OdnS/khbcV8ykI6WMo4pDdVrbCedSBPF0fYbakEZGSv kWqCnKqGO81/bkYhvgAVMquo7oDhsbNaW6WftXnbCrw0rNs4QqW+6FVNZfrjyN/l+U 5o9sTZl2STw4IEr6zxPxbmkDxXy+LKbIiT/qohxZYocYsi8G1D0pc93ohE2wRnVH0T ZPhAjAlnDZjzNlG8xIOxM8YojIAZroc2JXyMz87tHixJZKo91vblxPHUbyS2rpRFxZ 0nl7F/VMcjPUx/cEB5af9B7ISmNZ5EvTn6vDzysNzJjkexOcdNN1uuajqI/IbIpbFH 9jYbkPAdnCgGg== From: Sasha Levin To: 25031212351@stu.xidian.edu.cn, byu@xidian.edu.cn, wencheng@xidian.edu.cn, tiwai@suse.de Cc: stable@vger.kernel.org Subject: FAILED: patch "[PATCH] ALSA: hwdep: Serialize DSP load requests" failed to apply to 5.10-stable tree Date: Mon, 9 Nov 2026 20:25:59 -0500 Message-ID: <20261109202559-failed-5.10-aee83c204f80@kernel.org> X-Mailer: git-send-email 2.53.0 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x aee83c204f80d56b4d55f53acdb8594308ddcd4a # git commit -s git send-email --to '' --in-reply-to '20261109202559-failed-5.10-aee83c204f80@kernel.org' --subject-prefix 'PATCH 5.10.y' 'HEAD^..' Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From aee83c204f80d56b4d55f53acdb8594308ddcd4a Mon Sep 17 00:00:00 2001 From: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Date: Thu, 29 Oct 2026 16:48:09 +0800 Subject: [PATCH] ALSA: hwdep: Serialize DSP load requests The check of the loaded DSP indices and the call of the driver's dsp_load callback in snd_hwdep_dsp_load() are not serialized. A hwdep file descriptor can be shared among threads, or inherited across fork, so two SNDRV_HWDEP_IOCTL_DSP_LOAD requests for the same index can both observe the index as unloaded and enter the driver's callback concurrently, even though the device itself is opened exclusively. This breaks the assumption behind hw->dsp_loaded that a firmware index is loaded only once. For example, snd-usb-usx2y hits WARN_ON(usx2y->as04.buffer) in usx2y_async_seq04_init() and may allocate the US-428 sequence URBs twice. Serialize the check, the callback invocation and the bookkeeping with a per-hwdep mutex, so that the second request returns -EBUSY. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Link: https://patch.msgid.link/20261029084810.21910-2-25031212351@stu.xidian.edu.cn Signed-off-by: Takashi Iwai --- include/sound/hwdep.h | 1 + sound/core/hwdep.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h index b0da633184cde..7357727f06603 100644 --- a/include/sound/hwdep.h +++ b/include/sound/hwdep.h @@ -57,6 +57,7 @@ struct snd_hwdep { struct mutex open_mutex; int used; /* reference counter */ + struct mutex dsp_mutex; /* serializes DSP load requests */ unsigned int dsp_loaded; /* bit fields of loaded dsp indices */ unsigned int exclusive:1; /* exclusive access mode */ }; diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index c6de5345e946f..fb9034897c561 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -212,6 +212,7 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw, return -ENXIO; if (info->index >= 32) return -EINVAL; + guard(mutex)(&hw->dsp_mutex); /* check whether the dsp was already loaded */ if (hw->dsp_loaded & (1u << info->index)) return -EBUSY; @@ -380,6 +381,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, init_waitqueue_head(&hwdep->open_wait); mutex_init(&hwdep->open_mutex); + mutex_init(&hwdep->dsp_mutex); hwdep->card = card; hwdep->device = device; if (id) -- 2.53.0