lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  5 Jun 2019 15:45:45 +0200
From:   Amadeusz Sławiński 
        <amadeuszx.slawinski@...ux.intel.com>
To:     alsa-devel@...a-project.org
Cc:     Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Jie Yang <yang.jie@...ux.intel.com>,
        Cezary Rojewski <cezary.rojewski@...el.com>,
        linux-kernel@...r.kernel.org,
        Amadeusz Sławiński 
        <amadeuszx.slawinski@...el.com>
Subject: [PATCH 03/14] ALSA: hdac: Fix codec name after machine driver is unloaded and reloaded

From: Amadeusz Sławiński <amadeuszx.slawinski@...el.com>

This resets internal index used for enumarating codecs. This will only
work on assumption that platform has one codec. Anyway if there is more,
it won't work with current machine drivers, because we can't guarantee
order in which they are enumerated. This workarounds the fact that most
intel machine drivers have the following defined:
.codec_name = "ehdaudio0D2",
However when we unload and reload machine driver idx gets incremented,
so .codec_name would've needed to be set to ehdaudio1D2 on first reload
and so on.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@...el.com>
---
 sound/hda/ext/hdac_ext_bus.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index f33ba58b753c..c84d69c2eba4 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -77,6 +77,8 @@ static const struct hdac_io_ops hdac_ext_default_io = {
 	.dma_free_pages = hdac_ext_dma_free_pages,
 };
 
+static int idx;
+
 /**
  * snd_hdac_ext_bus_init - initialize a HD-audio extended bus
  * @ebus: the pointer to extended bus object
@@ -93,7 +95,6 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 			const struct hdac_ext_bus_ops *ext_ops)
 {
 	int ret;
-	static int idx;
 
 	/* check if io ops are provided, if not load the defaults */
 	if (io_ops == NULL)
@@ -118,6 +119,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
 void snd_hdac_ext_bus_exit(struct hdac_bus *bus)
 {
 	snd_hdac_bus_exit(bus);
+	/* FIXME: this is workaround
+	 * reset index used for bus->idx, because machine drivers expect
+	 * the codec name to be ehdaudio0D2, where 0 is bus->idx
+	 * we only perform reset if there is one used device, if there is more
+	 * all bets are off
+	 */
+	if (idx == 1)
+		idx = 0;
 	WARN_ON(!list_empty(&bus->hlink_list));
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ