All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: topology: Select SND_DYNAMIC_MINORS
@ 2021-07-26 18:21 Pierre-Louis Bossart
  2021-07-27 15:46 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Louis Bossart @ 2021-07-26 18:21 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, vkoul, broonie, Peter Ujfalusi, Pierre-Louis Bossart

From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

The indexes of the devices are described within the topology file, it is a
possibility that the topology encodes invalid indexes when DYNAMIC_MINORS
is not enabled in kernel:

 #define SNDRV_MINOR_COMPRESS		2	/* 2 - 3 */
 #define SNDRV_MINOR_HWDEP		4	/* 4 - 7 */
 #define SNDRV_MINOR_RAWMIDI		8	/* 8 - 15 */
 #define SNDRV_MINOR_PCM_PLAYBACK	16	/* 16 - 23 */
 #define SNDRV_MINOR_PCM_CAPTURE	24	/* 24 - 31 */

If the topology assigns an index greater than 7 for PLAYBACK/CAPTURE PCM
then there will be minor number collision.

As an example:
card0 creates a capture PCM with index 10 -> minor = 34
card1 creates compress device with index 0 -> minor = 34

Card1 will fail to instantiate because the minor for the compress stream is
already taken.

To avoid seemingly mysterious issues with card creation, select the
DYNAMIC_MINORS when the topology is enabled.

The other option would be to try to do out of bound index checks in case of
DYNAMIC_MINOR is not enabled and do not even attempt to create the device
with failing the topology load.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
index 8a13462e1a63..5dcf77af07af 100644
--- a/sound/soc/Kconfig
+++ b/sound/soc/Kconfig
@@ -36,6 +36,7 @@ config SND_SOC_COMPRESS
 
 config SND_SOC_TOPOLOGY
 	bool
+	select SND_DYNAMIC_MINORS
 
 config SND_SOC_TOPOLOGY_KUNIT_TEST
 	tristate "KUnit tests for SoC topology"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: topology: Select SND_DYNAMIC_MINORS
  2021-07-26 18:21 [PATCH] ASoC: topology: Select SND_DYNAMIC_MINORS Pierre-Louis Bossart
@ 2021-07-27 15:46 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-07-27 15:46 UTC (permalink / raw)
  To: alsa-devel, Pierre-Louis Bossart; +Cc: tiwai, vkoul, Mark Brown, Peter Ujfalusi

On Mon, 26 Jul 2021 13:21:42 -0500, Pierre-Louis Bossart wrote:
> The indexes of the devices are described within the topology file, it is a
> possibility that the topology encodes invalid indexes when DYNAMIC_MINORS
> is not enabled in kernel:
> 
>  #define SNDRV_MINOR_COMPRESS		2	/* 2 - 3 */
>  #define SNDRV_MINOR_HWDEP		4	/* 4 - 7 */
>  #define SNDRV_MINOR_RAWMIDI		8	/* 8 - 15 */
>  #define SNDRV_MINOR_PCM_PLAYBACK	16	/* 16 - 23 */
>  #define SNDRV_MINOR_PCM_CAPTURE	24	/* 24 - 31 */
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: topology: Select SND_DYNAMIC_MINORS
      commit: 2635c226036c1bf44b86575d0bc721505c8201e3

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-27 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 18:21 [PATCH] ASoC: topology: Select SND_DYNAMIC_MINORS Pierre-Louis Bossart
2021-07-27 15:46 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.