From patchwork Fri Jun 14 12:47:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13698677 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 ACF4519645D; Fri, 14 Jun 2024 12:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; cv=none; b=oyBkeey65C89eeE6KhbEqo4eueQCFPpn9Qas9I2VCqePL/DzV7rk2W3tb0wG12LJRHvuEsbG4INpMl6WcOuBW/jB8lfKZ+yvmXLlPsNkrns3KMHBXo6GfoHyq8f/c4ASRlCWavISe6t9MyQ1XGHZ0A1rQ56+mh6GO3k0OM1Eblo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; c=relaxed/simple; bh=MeJrCVvMIPktTSQH7Hu/dNYm3TzDEwvq64XMzLn9hVs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cxb3aNoQk6S09qOOResTrCDESU4ni0FepcflYGxNTaQj0sp/LwnoxslmaZ5cWXinAKyfpMAkEDBc0WsHr/dctxg2neGJTBjhxq85JmZrXf6ozG2t6fMX+LqjDVyeDZuq/JdKTYwlPuWxnPnknvoopMqGWX8tH9AIBA2Un+ltU0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=A0ByNGzr; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=bEC7lQES; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=A0ByNGzr; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=bEC7lQES; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="A0ByNGzr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bEC7lQES"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="A0ByNGzr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bEC7lQES" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B6FAE204C9; Fri, 14 Jun 2024 12:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369225; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x3rD0UBBiB4fwDr7WCsD3zCQa/HdNNWqxiGafHFqAQo=; b=A0ByNGzrwVfJq8ys03b52yPyIheQhYSXR8EIXnp6/1UJR/UqnulSZTUWlNJgc80Ybcv9hz yNmFRWnD5t2eH1oehEtmGmS2j+VFVJNgMk+9Ws+Zw9XKd4vFC2Nu/ueHVDzIsx2sHXX4Nn u8r5CXdDj5a1qDqz29uBXe6Mq2pEQto= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369225; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x3rD0UBBiB4fwDr7WCsD3zCQa/HdNNWqxiGafHFqAQo=; b=bEC7lQESGafuXnnMfL/JdATdh6EuyOvQl2FowLY0DBpNR7Yyt8KpWT3QeUEm8Tx5EJiIo1 rfVkPOBZ+Pfbf8BA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=A0ByNGzr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=bEC7lQES DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369225; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x3rD0UBBiB4fwDr7WCsD3zCQa/HdNNWqxiGafHFqAQo=; b=A0ByNGzrwVfJq8ys03b52yPyIheQhYSXR8EIXnp6/1UJR/UqnulSZTUWlNJgc80Ybcv9hz yNmFRWnD5t2eH1oehEtmGmS2j+VFVJNgMk+9Ws+Zw9XKd4vFC2Nu/ueHVDzIsx2sHXX4Nn u8r5CXdDj5a1qDqz29uBXe6Mq2pEQto= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369225; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x3rD0UBBiB4fwDr7WCsD3zCQa/HdNNWqxiGafHFqAQo=; b=bEC7lQESGafuXnnMfL/JdATdh6EuyOvQl2FowLY0DBpNR7Yyt8KpWT3QeUEm8Tx5EJiIo1 rfVkPOBZ+Pfbf8BA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 86E4913AB5; Fri, 14 Jun 2024 12:47:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EDjPH8k7bGYxMAAAD6G6ig (envelope-from ); Fri, 14 Jun 2024 12:47:05 +0000 From: Takashi Iwai To: linux-sound@vger.kernel.org Cc: Paul Menzel , Mark Brown , Jaroslav Kysela , linux-kselftest@vger.kernel.org Subject: [PATCH 1/5] ALSA: vmaster: Return error for invalid input values Date: Fri, 14 Jun 2024 14:47:23 +0200 Message-ID: <20240614124728.27901-2-tiwai@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240614124728.27901-1-tiwai@suse.de> References: <20240614124728.27901-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spamd-Result: default: False [-2.96 / 50.00]; BAYES_HAM(-2.95)[99.79%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email,suse.de:dkim]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: B6FAE204C9 X-Spam-Flag: NO X-Spam-Score: -2.96 X-Spam-Level: So far the vmaster code has been tolerant about the input values and accepts any values by correcting internally. But now our own selftest starts complaining about this behavior, so let's be picky and change the behavior to return -EINVAL for invalid input values instead. Reported-by: Paul Menzel Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Signed-off-by: Takashi Iwai --- sound/core/vmaster.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 04a57f7be6ea..c657659b236c 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c @@ -198,6 +198,12 @@ static int follower_put(struct snd_kcontrol *kcontrol, err = follower_init(follower); if (err < 0) return err; + for (ch = 0; ch < follower->info.count; ch++) { + if (ucontrol->value.integer.value[ch] < follower->info.min_val || + ucontrol->value.integer.value[ch] > follower->info.max_val) + return -EINVAL; + } + for (ch = 0; ch < follower->info.count; ch++) { if (follower->vals[ch] != ucontrol->value.integer.value[ch]) { changed = 1; @@ -365,6 +371,8 @@ static int master_put(struct snd_kcontrol *kcontrol, new_val = ucontrol->value.integer.value[0]; if (new_val == old_val) return 0; + if (new_val < master->info.min_val || new_val > master->info.max_val) + return -EINVAL; err = sync_followers(master, old_val, new_val); if (err < 0) From patchwork Fri Jun 14 12:47:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13698678 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 AED86196D80; Fri, 14 Jun 2024 12:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; cv=none; b=eGuvwCjPE60Yd9z18n0jGF6LNQqQCeo/VfWitcosOMkI2nrsznR+CGInT9f4q7x1Gp4Eq6XlcwYV2+6HDGGPeJYNzhmyF2+6nAg2OnJEfJaBzMgZGSY7GNMHS+z4Uq6gtlgYSWC3DyRG/HUthvKWyHwNVeauxV1KXgTqmUNpjnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; c=relaxed/simple; bh=z5bY5N3g+5re4gRtj2iJY/pN+tinHZeFUELmpRx8904=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sv6pIC7oHp3uOTbs04PJFZtCUFV9bGx3EZ0ltbsNEvdzEUkWCPzX6EPdqILjs3EsxgKwk2ABEHKdyHLnkJw2THu1IP4o9O4qSPAEzQ5Sb0p0k3yzFuYveUIWH+FbfvUta7YZADmbzqzPNIJjUtXL6prdWdPxDxLk1Mcc7aTdNeY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=PgkvcUEP; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=CO0Ce26k; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=aiQR7ABp; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=f/ckpIf7; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="PgkvcUEP"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="CO0Ce26k"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="aiQR7ABp"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="f/ckpIf7" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E9A30337FA; Fri, 14 Jun 2024 12:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G9Qwt3lCVOFdtC2z4kfL60uM7ul27YPCg9xUdo77z/A=; b=PgkvcUEPnHOC3aAz2M+oTfAsqMxljICxe3RK0+8rmfQieATqSa4hgy3flNvX6aLZ4SVoDo /CfrwYOW0m5TMn64BJ/pBRdtBe5Q8ye4HhE3uxJ1Jlw94MqofxXGqKVvCKvl6az8xmymX2 fCCrm0Qep7iZQSKda1xISqbQsC8jzso= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G9Qwt3lCVOFdtC2z4kfL60uM7ul27YPCg9xUdo77z/A=; b=CO0Ce26k+c7ZrEh1xuUjXhz69yju6Gim5gcNv8fAbFdj5VRAaPHVuznOBmVS8EPSHpa3ec rs7GMzNNXJvUQUDQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369225; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G9Qwt3lCVOFdtC2z4kfL60uM7ul27YPCg9xUdo77z/A=; b=aiQR7ABpChH0SrnE9XNQK19/bB9mtG98I1qkzTDe6pTMmIFKoDHz9YOs8bs4YolFhzjtv5 u0r2Kyfa9D9533U5w6CdWQnA8uqerinjmanZuCGDc68kcbljIMKcMBFte8J6qlBYXpJSs6 9FVglm5Ke7oAmhN9cpCjIQREIoM2WeY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369225; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G9Qwt3lCVOFdtC2z4kfL60uM7ul27YPCg9xUdo77z/A=; b=f/ckpIf7IVjmaqKWkIGzhp4hqylLjo8oArhFtUmDcgYxT2b8vRIKgOQW7Z3PpgBoL5n8Yk PmhSp9ZiVHE05hAA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BD41F13AB1; Fri, 14 Jun 2024 12:47:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +PXfLMk7bGYxMAAAD6G6ig (envelope-from ); Fri, 14 Jun 2024 12:47:05 +0000 From: Takashi Iwai To: linux-sound@vger.kernel.org Cc: Paul Menzel , Mark Brown , Jaroslav Kysela , linux-kselftest@vger.kernel.org Subject: [PATCH 2/5] ALSA: hda: Return -EINVAL for invalid volume/switch inputs Date: Fri, 14 Jun 2024 14:47:24 +0200 Message-ID: <20240614124728.27901-3-tiwai@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240614124728.27901-1-tiwai@suse.de> References: <20240614124728.27901-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email]; RCVD_TLS_ALL(0.00)[] So far the HD-audio driver has been tolerant about the input values and accepts any values by correcting the amp volume and switch values internally. But now our own selftest starts complaining about this behavior, so let's be picky and change the behavior to return -EINVAL for invalid input values instead. Reported-by: Paul Menzel Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 325e8f0b99a8..3dd1bda0c5c6 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1496,7 +1496,7 @@ update_amp_value(struct hda_codec *codec, hda_nid_t nid, /* ofs = 0: raw max value */ maxval = get_amp_max_value(codec, nid, dir, 0); if (val > maxval) - val = maxval; + return -EINVAL; return snd_hda_codec_amp_update(codec, nid, ch, dir, idx, HDA_AMP_VOLMASK, val); } @@ -1547,13 +1547,21 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, unsigned int ofs = get_amp_offset(kcontrol); long *valp = ucontrol->value.integer.value; int change = 0; + int err; if (chs & 1) { - change = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); + err = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); + if (err < 0) + return err; + change |= err; valp++; } - if (chs & 2) - change |= update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); + if (chs & 2) { + err = update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); + if (err < 0) + return err; + change |= err; + } return change; } EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_put); @@ -2149,15 +2157,20 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, int change = 0; if (chs & 1) { + if (*valp < 0 || *valp > 1) + return -EINVAL; change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, HDA_AMP_MUTE, *valp ? 0 : HDA_AMP_MUTE); valp++; } - if (chs & 2) + if (chs & 2) { + if (*valp < 0 || *valp > 1) + return -EINVAL; change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, HDA_AMP_MUTE, *valp ? 0 : HDA_AMP_MUTE); + } hda_call_check_power_status(codec, nid); return change; } From patchwork Fri Jun 14 12:47:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13698679 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 CFB321990C7; Fri, 14 Jun 2024 12:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; cv=none; b=hTAqVQyz0J36lRp4kuIw+7pc3CMqd6wOyxUcIGestnJSLrVrz6KrpIhXzGU/EiK9HXnUU0tC1J+LEE/EC3tKFuOTZCziVKB75Iarb91ZKAdsU+ZOipbKKXr7W6bZCpUmvponmc9gtHNL4Dt8wCQ6UVhKy9uxrKuRd93geJFS/QM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; c=relaxed/simple; bh=nc5RSxlJz/19yCGJlbD8cO5juxumVMtSIYyQzApOhgM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YNIcKEe0exeP6zQNtEVc3oAeb83F9O8WJOVzz0zby4iSt6p1hxrGFD5YFtDpH53mDne+KcUPo0qguw9q6Gxc4wauELQmiobIUoBnaEGrTF1Th39brHH+lIMp46ZIyQ9EHE9VbwneQm1QvexLmRCV0QI12yFn1DrHHUpuUfRqM4U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=qa2vuHKW; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=cEXAk6xn; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=qa2vuHKW; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=cEXAk6xn; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="qa2vuHKW"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="cEXAk6xn"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="qa2vuHKW"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="cEXAk6xn" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 26EB5337FC; Fri, 14 Jun 2024 12:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0fuGpBnMyoj+jvxlc8VWO7goEQAGNucd9xmvtJaLV3g=; b=qa2vuHKWVNKWPBxwm4u+/BR/uOira/pqbHAH01bdWJMX5ta3LYQSJrpZ44U7SCB3Qkt78z ZJkk7YisQw+TRcUhStKwYzW/1YDAxgQVu0i9lRXzc/2SPuE71ZsLl9+DIrebk+o0CAsJ1L ckVdvfq803T8KFvLPz8g+88rbcFd73k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0fuGpBnMyoj+jvxlc8VWO7goEQAGNucd9xmvtJaLV3g=; b=cEXAk6xn/ty9K7uWj7kZs0Oq6zYOXgJTx3iuIMLqzpAzAl3u3Xn+I1VMApLAv6S2OpTA53 RXCA2EvXSy6g9pDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0fuGpBnMyoj+jvxlc8VWO7goEQAGNucd9xmvtJaLV3g=; b=qa2vuHKWVNKWPBxwm4u+/BR/uOira/pqbHAH01bdWJMX5ta3LYQSJrpZ44U7SCB3Qkt78z ZJkk7YisQw+TRcUhStKwYzW/1YDAxgQVu0i9lRXzc/2SPuE71ZsLl9+DIrebk+o0CAsJ1L ckVdvfq803T8KFvLPz8g+88rbcFd73k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0fuGpBnMyoj+jvxlc8VWO7goEQAGNucd9xmvtJaLV3g=; b=cEXAk6xn/ty9K7uWj7kZs0Oq6zYOXgJTx3iuIMLqzpAzAl3u3Xn+I1VMApLAv6S2OpTA53 RXCA2EvXSy6g9pDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EE83213AB5; Fri, 14 Jun 2024 12:47:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id WEsZOck7bGYxMAAAD6G6ig (envelope-from ); Fri, 14 Jun 2024 12:47:05 +0000 From: Takashi Iwai To: linux-sound@vger.kernel.org Cc: Paul Menzel , Mark Brown , Jaroslav Kysela , linux-kselftest@vger.kernel.org Subject: [PATCH 3/5] ALSA: control: Apply sanity check of input values for user elements Date: Fri, 14 Jun 2024 14:47:25 +0200 Message-ID: <20240614124728.27901-4-tiwai@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240614124728.27901-1-tiwai@suse.de> References: <20240614124728.27901-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email]; RCVD_TLS_ALL(0.00)[] Although we have already a mechanism for sanity checks of input values for control writes, it's not applied unless the kconfig CONFIG_SND_CTL_INPUT_VALIDATION is set due to the performance reason. Nevertheless, it still makes sense to apply the check for user elements despite of its cost, as that's the only way to filter out the invalid values; the user controls are handled solely in ALSA core code, and there is no corresponding driver, after all. This patch enables the input value validation for user control elements no matter whether CONFIG_SND_CTL_INPUT_VALIDATION is set or not. The kselftest will be happier with this change, as the incorrect values will be bailed out now with errors. For other normal controls, the check is applied still only when CONFIG_SND_CTL_INPUT_VALIDATION is set. Reported-by: Paul Menzel Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Signed-off-by: Takashi Iwai Reviewed-by: Mark Brown --- sound/core/control.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/core/control.c b/sound/core/control.c index fb0c60044f7b..50890983d7e2 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1317,7 +1317,8 @@ static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, snd_ctl_build_ioff(&control->id, kctl, index_offset); result = snd_power_ref_and_wait(card); /* validate input values */ - if (IS_ENABLED(CONFIG_SND_CTL_INPUT_VALIDATION) && !result) { + if ((IS_ENABLED(CONFIG_SND_CTL_INPUT_VALIDATION) || + (vd->access & SNDRV_CTL_ELEM_ACCESS_USER)) && !result) { struct snd_ctl_elem_info info; memset(&info, 0, sizeof(info)); From patchwork Fri Jun 14 12:47:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13698680 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 28BBA19923E; Fri, 14 Jun 2024 12:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; cv=none; b=ieatPoycAi5ysF4CHSYzBL8OXikh2GPKjWeKYYBKTaQcTQ2i2MlW8dTE4YGIU9IeZRTQFg6pLxjivOsAzG42pSBb9c7BMW4KchZmIyk7vbcrpINm8DHkqHTaAhrsoe4oOu52cBN0AHysO9vhlkRzKZGztdxsUHWDiIjy1PU0GJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; c=relaxed/simple; bh=beh4tnX7MXVqAyxfWvOWrGjk31/eY32PNY47MX3Z5NE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rrlX8a0yXBjDjYrCtJLUKcCHPPKYW05/j/Mb1s7BmHs4m+TJGMqTD9+A5Tu8t5gU49qj1fXqfvN06chI6w9wliOduU5xxajN4Eq/eHhKx9XDvtgStKi/chtHTLQ3QdiJlGVKLLjj+naaOl1IT4+asaR9KXk778SnBfQdX1sB1p4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=InKAxofO; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=JhPgbewn; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=InKAxofO; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=JhPgbewn; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="InKAxofO"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="JhPgbewn"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="InKAxofO"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="JhPgbewn" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 61602337FD; Fri, 14 Jun 2024 12:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9u1VuVpEB9ug4lUHbTdVi7yYvusiqrU54jEtlU1TlLc=; b=InKAxofOKJEKQE9BJI3PFonyJ26UhCEbkDU7ADfiUCnQxdFk0LsEZaUhADekg21cfRYzHI tDeS1MpgjppjoB9CnyGJTmDByyLQFW1GXunmPnccJiItwpLWLXYCDGd2zr8edvuNQQ42MA 39JDf6AlrNDHrw1HFhYbgEprUjm9jrI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9u1VuVpEB9ug4lUHbTdVi7yYvusiqrU54jEtlU1TlLc=; b=JhPgbewn8xc1dl4EElmiEgwddWli01dMXMDbIGrhxS5gfvPERDowvbX0B/pqx2TudQ6jX4 +57oBG0nSigUPkCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9u1VuVpEB9ug4lUHbTdVi7yYvusiqrU54jEtlU1TlLc=; b=InKAxofOKJEKQE9BJI3PFonyJ26UhCEbkDU7ADfiUCnQxdFk0LsEZaUhADekg21cfRYzHI tDeS1MpgjppjoB9CnyGJTmDByyLQFW1GXunmPnccJiItwpLWLXYCDGd2zr8edvuNQQ42MA 39JDf6AlrNDHrw1HFhYbgEprUjm9jrI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9u1VuVpEB9ug4lUHbTdVi7yYvusiqrU54jEtlU1TlLc=; b=JhPgbewn8xc1dl4EElmiEgwddWli01dMXMDbIGrhxS5gfvPERDowvbX0B/pqx2TudQ6jX4 +57oBG0nSigUPkCg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 305D313AB1; Fri, 14 Jun 2024 12:47:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2EmXCso7bGYxMAAAD6G6ig (envelope-from ); Fri, 14 Jun 2024 12:47:06 +0000 From: Takashi Iwai To: linux-sound@vger.kernel.org Cc: Paul Menzel , Mark Brown , Jaroslav Kysela , linux-kselftest@vger.kernel.org Subject: [PATCH 4/5] kselftest/alsa: mixer-test: Skip write tests for volatile controls Date: Fri, 14 Jun 2024 14:47:26 +0200 Message-ID: <20240614124728.27901-5-tiwai@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240614124728.27901-1-tiwai@suse.de> References: <20240614124728.27901-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.98%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_TLS_ALL(0.00)[] The control elements with volatile flag don't guarantee that the written values are actually saved for the next reads, hence they aren't suitable for the standard mixer tests. Skip the write tests for those volatile controls for avoiding confusion. Reported-by: Paul Menzel Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Signed-off-by: Takashi Iwai --- tools/testing/selftests/alsa/mixer-test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c index 1c04e5f638a0..3c9a45fb5a29 100644 --- a/tools/testing/selftests/alsa/mixer-test.c +++ b/tools/testing/selftests/alsa/mixer-test.c @@ -702,6 +702,13 @@ static void test_ctl_write_default(struct ctl_data *ctl) return; } + if (snd_ctl_elem_info_is_volatile(ctl->info)) { + ksft_print_msg("%s is volatile\n", ctl->name); + ksft_test_result_skip("write_default.%d.%d\n", + ctl->card->card, ctl->elem); + return; + } + err = write_and_verify(ctl, ctl->def_val, NULL); ksft_test_result(err >= 0, "write_default.%d.%d\n", @@ -827,6 +834,13 @@ static void test_ctl_write_valid(struct ctl_data *ctl) return; } + if (snd_ctl_elem_info_is_volatile(ctl->info)) { + ksft_print_msg("%s is volatile\n", ctl->name); + ksft_test_result_skip("write_valid.%d.%d\n", + ctl->card->card, ctl->elem); + return; + } + switch (snd_ctl_elem_info_get_type(ctl->info)) { case SND_CTL_ELEM_TYPE_BOOLEAN: pass = test_ctl_write_valid_boolean(ctl); @@ -1039,6 +1053,13 @@ static void test_ctl_write_invalid(struct ctl_data *ctl) return; } + if (!snd_ctl_elem_info_is_volatile(ctl->info)) { + ksft_print_msg("%s is volatile\n", ctl->name); + ksft_test_result_skip("write_invalid.%d.%d\n", + ctl->card->card, ctl->elem); + return; + } + switch (snd_ctl_elem_info_get_type(ctl->info)) { case SND_CTL_ELEM_TYPE_BOOLEAN: pass = test_ctl_write_invalid_boolean(ctl); From patchwork Fri Jun 14 12:47:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13698681 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 53F8D1991B9; Fri, 14 Jun 2024 12:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; cv=none; b=daqyxbxkmB3yQaIGUvBcPX80ilS7B2Sbr8Ebg09kzIgSYBeZHNHyF0sm62FVBpDvfs01QO22zZkd7sSjszBE5++358JtACJ+TqdW7/UqZ7C1fMmKBtAaSZYKKliqaO17arDh42fMr/DBupXJSanWVR/YHUGop9uD+10PI56YPD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718369229; c=relaxed/simple; bh=Li8Q86IIel7loElKpSiC0v7dZha9mHyE+pCjFUohhGI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C7ttRC+ZVPVqGvlOlsB7sA/RmSKF7wLIoNEH/gAXDbY0cBvLOn08rYNcXqgOFOsnrBS7d4jdGkOC5+QLZCigx/0F5JraAIsskyGQyOGcTLRPUQFR9rz+FLoCBv0IzL9h3Xwzg9LDC5eAbXcDDOL/1Gp/4disH4sN4gKDnfCASGU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=YbJtHLmb; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=3fBFN86N; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=YbJtHLmb; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=3fBFN86N; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="YbJtHLmb"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="3fBFN86N"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="YbJtHLmb"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="3fBFN86N" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 94E55337FF; Fri, 14 Jun 2024 12:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q4r40IoY07C6m91tyhR/8RkBDYdaql61WuR3SCynXHA=; b=YbJtHLmbDv4CQF344LO4c6xiLxAue42KV9IgE1rU/mIGg0BYo8uCASq0tSiaXBOdQBbl25 DIc5p9qHaIbAqVIDwSi0qP5N985tOWBFYLtDEov3/sWWLnxTodiT+6GcIzbx5k+w2/zW6l wFC7DLSBERWhl51ryHkRm3eRFABhstE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q4r40IoY07C6m91tyhR/8RkBDYdaql61WuR3SCynXHA=; b=3fBFN86Nhh9S8mS+Rij9A0V62HTV05N9Hli0sQtbCww6kEbHG3MO0a7FptBkZV42Pj7RZB F2obXZi4wW82mTDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q4r40IoY07C6m91tyhR/8RkBDYdaql61WuR3SCynXHA=; b=YbJtHLmbDv4CQF344LO4c6xiLxAue42KV9IgE1rU/mIGg0BYo8uCASq0tSiaXBOdQBbl25 DIc5p9qHaIbAqVIDwSi0qP5N985tOWBFYLtDEov3/sWWLnxTodiT+6GcIzbx5k+w2/zW6l wFC7DLSBERWhl51ryHkRm3eRFABhstE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718369226; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q4r40IoY07C6m91tyhR/8RkBDYdaql61WuR3SCynXHA=; b=3fBFN86Nhh9S8mS+Rij9A0V62HTV05N9Hli0sQtbCww6kEbHG3MO0a7FptBkZV42Pj7RZB F2obXZi4wW82mTDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 68BF213AB5; Fri, 14 Jun 2024 12:47:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id yIZcGMo7bGYxMAAAD6G6ig (envelope-from ); Fri, 14 Jun 2024 12:47:06 +0000 From: Takashi Iwai To: linux-sound@vger.kernel.org Cc: Paul Menzel , Mark Brown , Jaroslav Kysela , linux-kselftest@vger.kernel.org Subject: [PATCH 5/5] ALSA: chmap: Mark Channel Map controls as volatile Date: Fri, 14 Jun 2024 14:47:27 +0200 Message-ID: <20240614124728.27901-6-tiwai@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240614124728.27901-1-tiwai@suse.de> References: <20240614124728.27901-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 X-Spam-Level: The values returned from Playback Channel Map and Capture Channel Map controls may vary dynamically depending on the corresponding PCM stream. Mark those as volatile to indicate the values are unstable and not suitable for testing. Note that we may change the driver to return -EINVAL, but this would bring other side effects, such as "alsactl restore" would start receiving unexpected errors. So we still keep returning 0 for those invalid inputs. Reported-by: Paul Menzel Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Signed-off-by: Takashi Iwai --- sound/core/pcm_lib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 6f73b3c2c205..071c67cbc479 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -2556,6 +2556,7 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, struct snd_kcontrol_new knew = { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .access = SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE | SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, .info = pcm_chmap_ctl_info,