Re: [PATCH v1 2/3] ASoC: tas2781: add capture profile control and capture dapm event

Mark Brown <[email protected]> Mon, 3 Aug 2026 22:24:04 +0100
Newsgroups gmane.linux.sound
Message-ID <[email protected]>
--Bmb7TreN5Dz3Mj3P
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Aug 01, 2026 at 10:08:20AM +0800, Shenghao Ding wrote:
> Expose a new mixer control "Speaker Capture Profile Id" to user space,
> so that applications can configure which profile ID should be used
> for capture paths.

> +static int tasdevice_set_capture_profile_id(struct snd_kcontrol *kcontrol,
> +		struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
> +	struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec);
> +	int ret = 0;
> +
> +	if (tas_priv->rcabin.capture_profile_id !=
> +		ucontrol->value.integer.value[0]) {
> +		tas_priv->rcabin.capture_profile_id =
> +			ucontrol->value.integer.value[0];
> +		ret = 1;
> +	}

This is not doing any validation of the input from userspace so we can
happily end up specifying a profile that doesn't exist, and also read
back an invalid value from the control.

--Bmb7TreN5Dz3Mj3P
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmpxBvMACgkQJNaLcl1U
h9CHzgf+OLXg5bP6Z1cwjUPe151LWUOe2DWtEbyU6UNRLbhu2EJtVNFfqj/G7ela
ChQ26g70MSAHUEWQ/Pouq2SNjuSQC6voJs8UhuWi7JxdiDxMYAxzOiocE34/2+2n
b+9E8O4VgrvneR8m4WvYMgu+gtaiCis8tiT+lv8FCCuogXvlfOGpslFJcqcBPJ/u
bprJkLvrB3f37zKR2phFjmN4mBGmHfcX3Tywed791jY4SfYAIlObyanMCKAr4+j2
TTyrN8hlYhFP5jYjCiVy6IMLxXPNyUebCRb2MknNX3pJ0uf6ZMjnNchWNlZrAyjr
z+SvS14C3RLNFazun73f84VoUvtdUQ==
=sTxI
-----END PGP SIGNATURE-----

--Bmb7TreN5Dz3Mj3P--